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