is it even possible to write a program in c that prints out string input if unknown length to output only using getchar() and putchar()?
is it even possible to write a program in c that prints out string input if unknown length to output only using getchar() and putchar()?
Do you mean like this?
Code:#include <stdio.h> #include <ctype.h> int main() { int ch; while ((ch = getchar()) != EOF) { if (islower(ch)) ch = toupper(ch); putchar(ch); } return 0; }
A little inaccuracy saves tons of explanation. - H.H. Munro
hi thx for your answer
in my assignment it says that I can only use the std library <stdio.h>
I have been trying for over an hour and I can't get it. I have no Idea how it should work .
I didn't realize something so basic could be an "assignment". But the answer's there. It just has more than you need.
A little inaccuracy saves tons of explanation. - H.H. Munro
sry just ignore my first reply
and no thats the beginning of the assignment