C算法--string.h头文件

strlen()可以得到字符数组中第一个\0前的字符的个数

 1 #include <stdio.h>
 2 #include <string.h>
 3 
 4 int main(){
 5     char str [10];
 6     gets(str);
 7     int len=strlen(str);
 8     printf("%d\n",len);
 9     return 0;
10 }
strlen()

strcmp()

strcmp()函数返回两个字符串大小的比较结果,按字典序

猜你喜欢

转载自www.cnblogs.com/Catherinezhilin/p/11135888.html