+ 2

What is the best practice for new line in C++ endl or \n ?

18th Mar 2017, 10:05 PM
Utpal Chandra Das
Utpal Chandra Das - avatar
4 Answers
+ 2
endl flushes out any memory resources left out during the execution while \n doesn't. therefore, endl is a little slower than \n. usually you'll use endl, however, if the execution speed matters like in competitive coding, you'll want to use \n.
19th Mar 2017, 2:32 AM
Nikunj Arora
Nikunj Arora - avatar
+ 1
thanks to everyone
19th Mar 2017, 10:44 AM
Utpal Chandra Das
Utpal Chandra Das - avatar
0
\n
19th Mar 2017, 9:11 AM
Amit
Amit - avatar
0
"\n" easy << end
22nd Mar 2017, 10:36 PM
Beka27
Beka27 - avatar