我目前處於學習C編程的初級階段,正在使用Code :: Blocks工作通過「開始用C for Dummies編程」。 第7章中的第一項活動,用getchar()提取字符,要求我們按照書中介紹的完全複製代碼;見下圖: #include <stdio.h>
int main()
{
int c;
printf("I'm waiting for a character:
我有使用getchar()和文件重定向比較問題。 我有一個類似這樣的代碼: char result = getchar(); // getchar returns the next char in the file
int linecount = 0;
if (result == "\n") {
linecount++;
}
但在編譯時,我得到一個警告。它說,我不能比較一個i