C語言 字元操作函式

2022-06-18 01:42:11 字數 533 閱讀 4623

1字元陣列的初始化:

1.1 char string=

1.2char string=或者去掉{}即char string=「china"

1.3 strcpy(string,"china")

2字串長度:字串長度函式strlen(char string)=字元的個數+1(結束符"\0")

4字串操作函式:#include

4.1 輸入:gets(string)

4.2 輸出:puts(string)

4.5 字元比較:strcmp(str1,str2) // 0表示兩者完全相等,正表示str1>str2,負表示str14.6字串長度:strlen(str) //注意多乙個」\0「

4.7大小寫轉換:striwr(str)  //轉小寫

strupr(str) //轉大寫

4.8 字串查詢:char *strstr(const char *haystack, const char * needle);//從haystack中搜尋needle字串並返回第一次出現的位址(參考

C語言字串操作函式

引用自 1.字串反轉 strrev 2.字串複製 strcpy 3.字串轉化為整數 atoi 4.字串求長 strlen 5.字串連線 strcat 6.字串比較 strcmp 7.計算字串中的母音字元個數 8.判斷乙個字串是否是回文 1.寫乙個函式實現字串反轉 版本1 while版 void st...

C語言字串操作函式

c語言字串操作函式 1.字串反轉 strrev 2.字串複製 strcpy 3.字串轉化為整數 atoi 4.字串求長 strlen 5.字串連線 strcat 6.字串比較 strcmp 7.計算字串中的母音字元個數 8.判斷乙個字串是否是回文 1.寫乙個函式實現字串反轉 版本1 while版 v...

C語言字串操作函式

1.函式名 stpcpy 功 能 拷貝乙個字串到另乙個 用 法 char stpcpy char destin,char source 程式例 include include int main void 2.函式名 strcat 功 能 字串拼接函式 用 法 char strcat char des...