S
Saurav Bhasin
Hi
In this program from K&R:
#include <stdio.h>
main()
{
int c;
while(c=(getchar() != EOF))
{
printf("%d\n",c);
}
}
The output using GCC compiler is :
../a.out
1
1
1
2
2
2
why is the output 1 being printed 2 times, Since there is only 1
printf statement, should not it be printed only once?
Thanks,
In this program from K&R:
#include <stdio.h>
main()
{
int c;
while(c=(getchar() != EOF))
{
printf("%d\n",c);
}
}
The output using GCC compiler is :
../a.out
1
1
1
2
2
2
why is the output 1 being printed 2 times, Since there is only 1
printf statement, should not it be printed only once?
Thanks,