I have the code:
#include <stdio.h>
int main(void) {
int c;
c = getchar();
putchar(c);
return 0;
}
and after compiling and running, when I input k
for example, it prints out k%
.
Why is it printing out %
?
Edit: I tested a few things out and realized that it's the shell (I'm using zsh with oh-my-zsh configuration which is pretty awesome) that's doing that in order to get to a new line. I attached putchar('\n') at the end of the main()
function and it doesn't print that out. Thanks for the helpful comments.
(Please let me know the reasons for the downvotes so I could improve my further questions in the future)