在這里想把S1轉換為整數,輸出它的長度,為什么是個隨機數?
#include <stdio.h>
#include <string.h>
int main()
{
? ? char s1[100]="";
? ? char s2[]="我愛,";
? ? char s3[]="慕課網";
? ? /*在以下補全代碼*/
? ? strcpy(s1,s2);
? ? strcat(s1,s3);
? ??
? ??
? ? printf("%s\n",s1);
? ? atoi(s1);????????????????//在這里
? ? printf("%d",s1);
? ? return 0;? ?
}
為什么不是100,隨機數是因為是中文嗎?
2019-11-19
頭文件錯了應該是<stdlib>
2019-11-19
你的代碼寫的就有問題