When I print a string with printf like in the following:
#include <stdio.h>
void main(void)
{
printf("Foo");
}
In the output, I get the following:
As seen in this picture, there is a highlighted percent sign placed after the output of printf. What's causing this? How do I get rid of it?
CodePudding user response:
That's your shell's prompt. You're not printing a newline after the string "Foo", so the prompt appears immediately after it.
Add a newline to the string to print so the shell prompt appears on a separate line.
printf("Foo\n");
CodePudding user response:
Most likely the % is your terminal's prompt. Your program doesn't output a newline, so the next prompt would not appear on a new line.

