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