0

End/ vs \n which is better for changing line?

I want to know the memory usage by them.and other properties and why are there 2 functions with exact use.

24th Jan 2018, 2:20 AM
unknown
unknown - avatar
1 Odpowiedź
+ 3
The \n is an escape character used to represent the EOL (End of Line) character. The endl is a manipulator used to insert a \n in the stream buffer and then flush this buffer to the output. Thus endl is basically a \n with a flush operation, and that is what makes it a little slower. The flushing is useful to print data that has not been yet printed from the buffer and clear the buffer so that more data to be stored. You may read more on : https://www.sololearn.com/discuss/771853/?ref=app https://www.sololearn.com/discuss/127013/?ref=app https://www.sololearn.com/discuss/781814/?ref=app https://stackoverflow.com/questions/213907/c-stdendl-vs-n
24th Jan 2018, 3:17 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar