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; }
Ordinary language is totally unsuited for expressing what physics really asserts.
Only mathematics can say as little as the physicist means to say. - Bertrand Russell
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.
Ordinary language is totally unsuited for expressing what physics really asserts.
Only mathematics can say as little as the physicist means to say. - Bertrand Russell
sry just ignore my first reply
and no thats the beginning of the assignment