End a new line text in c
In C, you can end a line of text using the \n
character, which is an escape sequence that represents a newline.
Here are a few ways to do it:
-
Using the
\n
character:printf("Hello, world!\n");
This will print "Hello, world!" followed by a newline character.
-
Using the
puts
function:puts("Hello, world!");
The
puts
function automatically appends a newline character to the end of the string. -
Using the
fprintf
function:fprintf(stdout, "Hello, world!\n");
This will print "Hello, world!" followed by a newline character to the standard output stream.
Note that in all cases, the \n
character is a single character, not a string.