靚麗時尚館

位置:首頁 > 健康生活 > 心理

C語言string怎麼用

心理6.23K
C語言string怎麼用

#include &ltstdio.h>

void main(){

string words=""

printf("請輸入任意字串,按回車結束。n")

scanf("%s",&words)

printf("%s",words)

}

在網路中看到有一段這樣的程式碼,作者在C語言編輯器中編輯,無法通過,後來通過知道得知,C語言中只有String檔案,並沒有String型別,當然可能存在版本的原因存在。

string是一個頭檔案 #include<string.h> 就包涵了對字元處理的一些函式, 比如strlen用來計算串長度 strcpy是串拷貝函式 strcmp是串比較函式 。。。。。。。 必須包涵string.h這個標頭檔案,才能呼叫這些函式

標籤:語言 string