This is how I solved the exercise 1-12 from K&R. I have found another solution online, but mine seems a lot easier than the other, even if sometimes it prints too many newlines.
Is this solution acceptable? If not, why? Thank you in advance.
FSX
Code:#include <stdio.h> int main(void) { int c; while((c = getchar()) != EOF) { if((c == ' ') || (c == '\t')) putchar('\n'); else putchar(c); } return 0; }



LinkBack URL
About LinkBacks



