我目前处于学习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