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]的均勻隨機整數
轉載于:https://www.cnblogs.com/chihits/archive/2011/09/01/2161793.html
總結
以上是生活随笔為你收集整理的Some functions worth remembered in C Library (Updating)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ie8.0 不能用document.al
- 下一篇: GridView 控件的执行顺序