¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
Why we used 'endl' for go new line whereas we have already \n best option for go new line. ?
3 Respuestas
0
what is the memory concept of pointer..!!?
i want to discuss if any one interested
+ 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!!!
0
Yup what u want to discuss