Difference | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Difference

What's the difference between interpretation of '\n' and 'endl' commands by the processor? Are they if any significance? If yes, what are they? Thank you for the answer, in advance! :)

28th Aug 2017, 6:19 PM
Bhumika Rao
Bhumika Rao - avatar
1 Answer
+ 14
"\n" is just a string of length 1 that gets appended to stdout. std::endl , instead, is an object that will cause to append the newline character ( "\n" ) AND to flush stdout buffer. For this reason it will take more processing.
28th Aug 2017, 6:29 PM
P R
P R - avatar