I get that std::endl prints a newline character anyway but I heard it also flushes the buffer as well which means it's clearing all unused characters, correct?
Like, a console would write characters to itself using a buffer as a source of input, right? Sorry, this is me logically assuming how things might work.
This makes me more inclined to use endl over the newline character when printing using cout.
But I've heard flushing the buffer for ever cout call can get expensive in terms of time.
Should I just not care and use endl anyway?
I saw it from a poster here, something like
The first line is far easier to type, Imo, but I'm curious, what's the standard C++ way of using cout?Code:cout << "Hello, world!\n"; /* instead of */ cout << "Hello, world!" << endl;