This commit is contained in:
pommicket 2022-02-16 19:41:44 -05:00
parent c29bc36514
commit b1e837afb4
2 changed files with 128 additions and 8 deletions

View file

@ -15,9 +15,19 @@ int compar(const void *a, const void *b) {
int main(int argc, char **argv) {
char buf[36];
memset(buf, 'a', sizeof buf);
strncpy(buf, "hello, world!\n",36);
printf("%d\n",strcmp(buf, "hello, world!\n"));
strcpy(buf, "Hello there there!");
/* buf[36]='b'; */
printf("%s\n",strstr(buf," ther"));
static char str[] = "?a???b,,,#c";
char *t;
printf("%s\n", strtok(str, "?")); /* t points to the token "a" */
printf("%s\n", strtok(NULL, ","));
printf("%s\n", strtok(NULL, "#,"));
printf("%s\n", strtok(NULL, "?"));
return 0;
}