0
Hello! Why does fgets inserts also a new line character inside string?
Can someone explan me why when i use fgets to read a string from a file, it stores the data but also a new line character? When i print, lets say, 2 names with printf like this printf("%s", john); printf("%s", mary); The output is: John Mary But when i print like this: printf("%s\n", john); printf("%s\n", mary); The output is: John Mary Like this Many thanks
3 Answers
+ 1
Thanks to all of you so much. It makes sense now
0
\n is what is creating your newline. That is called an escape sequence.