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