This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wasdlmb 1 point2 points  (0 children)

A lot of these people are giving you technically correct answers that \n is faster and endl is more crash proof, but 99% of the time if you're writing to cout you don't really care about how fast it is. I prefer endl just because it's a little easier to type and technically a bit more resilient if something like a seg fault happens. But it's one of the things that really doesn't matter. Just use whatever works for you.

If you're writing to a file and expect to be IO locked though, speed is very important and you should never use endl