endl manipulator | Sololearn: Learn to code for FREE!

0

endl manipulator

I read that for a newline I can use the endl manipulator and I know from C that character '\n' also inserts a new line. Is there any difference between them, or '\n' has been kept in order to maintain backward compatibility with C?

8/19/2018 8:53:41 PM

Charalampos Kontos

4 Answers

New Answer

+5

1) this has been asked many times already. please search for it first. 2) endl, I believe, flushes the output. maybe I'm wrong...

+4

Yep, the guy with the links is here. Hooray. https://www.sololearn.com/Discuss/127013/?ref=app https://www.sololearn.com/Discuss/774902/?ref=app https://www.sololearn.com/Discuss/328868/?ref=app

+2

Charalampos Kontos you can't decide whether or not to "keep" "\n", it's a standardized general escape character, and it's based on the operating system, not the language

+1

endl is used to create the new line.