Download benchmarks/Engineering/string/strcat/solution.c from PV-SJTU/PV-Bench: direct link, hf CLI and curl.
- Browser
- Download file 435 Bytes
-
https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Engineering/string/strcat/solution.c
- Command line
-
hf download hf://datasets/PV-SJTU/PV-Bench/benchmarks/Engineering/string/strcat/solution.c
-
curl -L -o solution.c https://huggingface.co/datasets/PV-SJTU/PV-Bench/resolve/main/benchmarks/Engineering/string/strcat/solution.c
435 Bytes
| char *strcat(char *dest, char *src) | |
| { | |
| int i = 0; | |
| while (dest[i] != 0) { | |
| i++; | |
| } | |
| int j = 0; | |
| while (src[j] != 0) { | |
| dest[i + j] = src[j]; | |
| j++; | |
| dest[i + j] = 0; | |
| } | |
| return dest; | |
| } | |
| char *strncat(char *dest, char *src, int n) | |
| { | |
| int i = 0; | |
| while (dest[i] != 0) { | |
| i++; | |
| } | |
| int j = 0; | |
| while (j < n && src[j] != 0) { | |
| dest[i + j] = src[j]; | |
| j++; | |
| dest[i + j] = 0; | |
| } | |
| return dest; | |
| } | |