J
Junmin H.
hello, i just started to learn C. i have got some problems:
1)
why can "c = getchar() != EOF " can use as an argument of the loop
while()???
c = getchar() != EOF
is equivalent to
c = ( getchar() != EOF )
is it returning an ture or false???
2)
#include <stdio.h>
/* copy input to output; 1st version */
main(){
int c;
while((c = getchar()) == EOF){
printf("%d ",c);
//putchar(c);
}
}
why it doesnt output the value of EOF???
thanks
1)
#include <stdio.h>
/* copy input to output; 1st version */
main(){
int c;
while(c = getchar() != EOF){
putchar(c);
}
}
why can "c = getchar() != EOF " can use as an argument of the loop
while()???
c = getchar() != EOF
is equivalent to
c = ( getchar() != EOF )
is it returning an ture or false???
2)
#include <stdio.h>
/* copy input to output; 1st version */
main(){
int c;
while((c = getchar()) == EOF){
printf("%d ",c);
//putchar(c);
}
}
why it doesnt output the value of EOF???
thanks