Why isn't my code showing any output in c? Is it mandatory to use getchar with putchar? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why isn't my code showing any output in c? Is it mandatory to use getchar with putchar?

https://code.sololearn.com/cCyqBnVQF7YV/?ref=app

25th Jul 2018, 10:40 AM
Parth Salat
Parth Salat - avatar
3 Answers
+ 3
The integer 4 is stored as its ASCII character counterpart, which is an invisible character. http://www.asciitable.com/mobile/ You meant to store '4' instead of 4, perhaps.
25th Jul 2018, 10:42 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
putchar() writes a character to the standard output stream. http://www.cplusplus.com/reference/cstdio/putchar/ getchar() reads a character from the standard input stream. http://www.cplusplus.com/reference/cstdio/getchar/ puts() is simply a predefined function to print strings with a trailing newline at the end. http://www.cplusplus.com/reference/cstdio/puts/ gets() is deprecated. Just don't use it. https://stackoverflow.com/questions/30890696/why-gets-is-deprecated)
25th Jul 2018, 10:56 AM
Hatsy Rei
Hatsy Rei - avatar
0
Thanks Hatsy Rei, but I also wanted to know the difference between getchar /putchar and gets/puts in c
25th Jul 2018, 10:49 AM
Parth Salat
Parth Salat - avatar