Hi, I am learning C, I am using this book called "The C Programming Language, 2nd Edition" by Brian M. Ritchie. I have gotten to the point of learning charachter Input and Output, the book uses this following code which I have written and tried but compiles an error:
#include <stdio.h>
/*copy input to output - 1st version*/
main()
int c;
c = getchar();
while (c != EOF) {
putchar(c);
c = getchar();
}
}
Why does it give me an error. I am using Bloodshed C++ 4.9.9.2 and tried this program on Turbo C. The code comes directly from the book, all other programs were functional up to this point. Can any body help me, thankyou.
#include <stdio.h>
/*copy input to output - 1st version*/
main()
int c;
c = getchar();
while (c != EOF) {
putchar(c);
c = getchar();
}
}
Why does it give me an error. I am using Bloodshed C++ 4.9.9.2 and tried this program on Turbo C. The code comes directly from the book, all other programs were functional up to this point. Can any body help me, thankyou.