M
m_a_t_t
Ok, I'm reading "The C Programming Language: 2nd Edition" and I'm on
chapter 1.5.1 and here's the program you're sposed to make:
#include <stdio.h>
/* copy input to output; 1st version */
main()
{
int c;
c = getchar();
while (c != EOF) {
putchar(c);
c = getchar();
}
}
Ok, now here's what I'm confused about: I read it all and everything
and I'm not sure what it's sposed to do. I tried it and say if I type:
a
Then it'll mimic it, so if I type "a" and press enter it'll do this:
a
a
Is that what it's supposed to do? And if so then why doesn't it make a
difference if I take out the "!"(not equal to(I think)).
Any help is greatly appreciated, thanks!
chapter 1.5.1 and here's the program you're sposed to make:
#include <stdio.h>
/* copy input to output; 1st version */
main()
{
int c;
c = getchar();
while (c != EOF) {
putchar(c);
c = getchar();
}
}
Ok, now here's what I'm confused about: I read it all and everything
and I'm not sure what it's sposed to do. I tried it and say if I type:
a
Then it'll mimic it, so if I type "a" and press enter it'll do this:
a
a
Is that what it's supposed to do? And if so then why doesn't it make a
difference if I take out the "!"(not equal to(I think)).
Any help is greatly appreciated, thanks!