![](/img/trans.png)
[英]Function made for counting Letters in C doesn't work for the weirdest reasons
[英]Function for counting string length doesn't work
我有這個代碼
int conta(char *A){
int i = 0;
while (A[i] != "\0"){
i = i+1;
}
return i;
}
但是這會向我發出警告“對字符串文字的比較結果未指定”。 這只是Xcode的問題嗎? 因為我在使用Windows編譯器時看到了完全相同的代碼。
“\\ 0”確實是一個字符串文字。 我想你的意思是將字符值與'\\ 0'進行比較。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.