c = getchar();
is an expression and has a value, which is the value of the left hand side after the assignment.
This means that a assignment can appear as part of a larger expression. If the assignment of a
character to c is put inside the test part of a while loop, the copy program can be written this
way:
#include <stdio.h>
/* copy input to output */
main()
{
int c;
while((c = getchar()) != EOF)
putchar(c);
}
追问仰慕……您q多少?
本回答被网友采纳