What is difference between \n and endl | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is difference between \n and endl

2nd Dec 2016, 4:18 PM
Vibhu Srivastava
Vibhu Srivastava - avatar
2 Answers
+ 4
endl is a manipulator that inserts a new-line character. Additionally, for buffered streams, endl flushes the buffer (i.e. writes all unwritten characters in the buffer to the output sequence, see ostream::flush). And '\n' is actually a new-line character.
2nd Dec 2016, 4:26 PM
Aditya kumar pandey
Aditya kumar pandey - avatar
0
no difference both use for end linr!
2nd Dec 2016, 4:22 PM
Abrar Hussain
Abrar Hussain - avatar