0

Why we used 'endl' for go new line whereas we have already \n best option for go new line. ?

22nd Mar 2017, 10:28 AM
AMAN VERMA
AMAN VERMA - avatar
3 Respuestas
0
what is the memory concept of pointer..!!? i want to discuss if any one interested
25th Nov 2017, 9:34 PM
AMAN VERMA
AMAN VERMA - avatar
+ 1
Funny you should ask. I found myself in a similar position and did some research. So here's why: endl appends '\n' to the stream and calls flush() on the stream. So cout << x << endl; is equivalent to cout << x << '\n'; cout.flush(); Here's an interesting discussion on why flushing may be necessary. http://www.dreamincode.net/forums/topic/214763-why-flush-a-stream/ Happy coding!!!
22nd Mar 2017, 10:43 AM
wmik
0
Yup what u want to discuss
22nd Jan 2020, 6:40 PM
AMAN VERMA
AMAN VERMA - avatar