\n or endl?

Hi,

What is the difference between \n and std:endl in your statements? Does it matter which one I use?

std::endl just does '\n' followed by a flush (write out). But terminals are typically line buffered so would flush on a newline anyway.

More info: C++ Weekly - Ep 7 Stop Using std::endl - YouTube

Privacy & Terms