diff options
author | pommicket <pommicket@gmail.com> | 2022-02-16 19:41:44 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-02-16 19:41:44 -0500 |
commit | b1e837afb44f9053763d6a654a5f7bb2757a39d4 (patch) | |
tree | a767a2b7e050f66cd5c8b35e18e8b9d411b7d7ad /05/main.c | |
parent | c29bc365146cc3800b2bebfaa3dff1461240668f (diff) |
string.h
Diffstat (limited to '05/main.c')
-rw-r--r-- | 05/main.c | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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; } |