0
Why isn't my code showing any output in c? Is it mandatory to use getchar with putchar?
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.
+ 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)
0
Thanks Hatsy Rei, but I also wanted to know the difference between getchar /putchar and gets/puts in c