the last parts of the C standard library
This commit is contained in:
parent
b1e837afb4
commit
6e1158f49a
8 changed files with 361 additions and 32 deletions
26
05/main.c
26
05/main.c
|
@ -4,30 +4,12 @@
|
|||
#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;
|
||||
}
|
||||
#include <time.h>
|
||||
#include <float.h>
|
||||
|
||||
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, "?"));
|
||||
|
||||
|
||||
srand(time(NULL));
|
||||
printf("%d\n",rand());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue