Some functions worth remembered in C Library (Updating)

1. <stdio.h>
scanf
printf
putchar()
getchar() = fgetc(stdin)
gets(buf) = fgets(buf, MAXN, stdin)
note that gets is deprecated in C
2. <ctype.h>
isalpha
isdigit
isprint
tolower
toupper
3. <string.h>
strchr,在字符串中查找字符
strcpy,字符串拷贝
strcmp,字符串比较,0 return value indicates equality
strcat,字符串连接
sscanf,从字符串输入,sscanf的格式化输入可以使用%*s 来表示任何字符串,比如sscanf("abcd 123", "%*s %d", &intA)
sprintf,输出到字符串
memset(pointer, value, byte_size),  

4. <assert.h>
assert函数
5. <stdlib.h>
srand(),用来初始化随机数种子,种子是伪随机数计算的依据,种子相同,计算出来的随机数序列总是相同。
rand(),生成一个闭区间[0, RAND_MAX]的均匀随机整数

posted on 2011-09-01 11:40  chihits  阅读(156)  评论(0编辑  收藏  举报

导航