Does Printf Automatically add \n when it prints strings(%s) C LANGUAGE | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Does Printf Automatically add \n when it prints strings(%s) C LANGUAGE

The question is in the title. I've written a code and even though in this string input[0] to input [100] is = '\0' when I use printf("%s", input) it also prints a newline although there is not any \n character in the elements of string. If this is the case and if there is a way to prevent it I'd like to change it because it's the essential of the code. Edit: Thank you for your answer. I was mistaken and your answer helped me to recognize that. The problem's solved.

2nd Feb 2020, 8:47 PM
mert aydın
2 Answers
+ 3
can you show the code, your question seem not to be clear enough, and printf don't add newline only puts and fputs do that
2nd Feb 2020, 8:50 PM
✳AsterisK✳
✳AsterisK✳ - avatar
0
I've messaged you
2nd Feb 2020, 9:02 PM
mert aydın