lang-bootstrap/05/main.c

34 lines
719 B
C
Raw Normal View History

2022-02-14 22:43:25 -05:00
#define _STDLIB_DEBUG
2022-02-15 22:41:18 -05:00
#include <math.h>
#include <stdio.h>
2022-02-16 12:25:14 -05:00
#include <signal.h>
2022-02-16 15:41:30 -05:00
#include <stdlib.h>
2022-02-16 15:57:45 -05:00
#include <string.h>
2022-02-16 15:41:30 -05:00
int compar(const void *a, const void *b) {
int i = *(int *)a;
int j = *(int *)b;
if (i < j) return -1;
if (i > j) return 1;
return 0;
}
2022-02-16 12:25:14 -05:00
2022-02-15 16:36:52 -05:00
int main(int argc, char **argv) {
2022-02-16 15:57:45 -05:00
char buf[36];
2022-02-16 19:41:44 -05:00
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;
2022-02-09 22:44:27 -05:00
}
2022-02-12 21:27:57 -05:00