summaryrefslogtreecommitdiff
path: root/05/main.c
blob: 2dc7b813ffde1aefa139ed88b0c36fc23df9d5d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#define _STDLIB_DEBUG
#include <math.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>

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;
}

int main(int argc, char **argv) {
	char buf[36];
	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;
}