strcmp怎么比較字符串大小 C語言中用什么函數(shù)可以得到一個字符串的長度?
C語言中用什么函數(shù)可以得到一個字符串的長度?c語言中獲得一個字符串長度的函數(shù)是:strlen(),舉例如下:#include#includemain()(char *str="this is a te
C語言中用什么函數(shù)可以得到一個字符串的長度?
c語言中獲得一個字符串長度的函數(shù)是:strlen(),舉例如下:
#include
#include
main()
(
char *str="this is a test msg"
printf("%dn",strlen(str))
getch()
)
c語言求字符串長度,的函數(shù)理解?
計算長度有兩個函數(shù):strlen sizeof
strlen 計算字符串里面一共有多少個字符
sizeof 計算字符串占的總內(nèi)存空間
如:
char str[20]={"123456"}
strlen(str)等于 6
sizeof(str) 等于20
-物聯(lián)網(wǎng)校企聯(lián)盟技術(shù)部