summaryrefslogtreecommitdiff
path: root/05/main.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-02-16 19:41:44 -0500
committerpommicket <pommicket@gmail.com>2022-02-16 19:41:44 -0500
commitb1e837afb44f9053763d6a654a5f7bb2757a39d4 (patch)
treea767a2b7e050f66cd5c8b35e18e8b9d411b7d7ad /05/main.c
parentc29bc365146cc3800b2bebfaa3dff1461240668f (diff)
string.h
Diffstat (limited to '05/main.c')
-rw-r--r--05/main.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/05/main.c b/05/main.c
index 6757ec7..2dc7b81 100644
--- a/05/main.c
+++ b/05/main.c
@@ -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;
}