Hello, from K&R, separating c=getchar() leads the program to ignore CTRL-Z
Code:
#include <stdio.h>
int main(void)
{
int c, pc;
while(getchar != EOF)
{
c = getchar();
if((c == ' ') && (pc != c))
putchar(c);
else if (c != ' ')
putchar(c);
pc = c;
}
return 0;
}
I would like to understand why, the compiler says: warning C4047: '!=' : 'int (__cdecl *)(void)' differs in levels of indirection from 'int' and I don't know what this means. Maybe the getchar() function returns an INT? I still lack the knowledge to understand what type VOID is.
Thank you in advance.
P.S. sorry I just found out that I omitted the () in getchar. Sorry and thanks anyway...