Difference Between endl and ‘ ‘

Difference Between endl and ‘ ‘

Take a look at the following code:

#include int main(){  int i = 12;  std::cout 

Using '
is a request to output a newline. Likewise, using endl requests to output a newline, but it also flushes the output stream. In other words, endl has the same effect as (ignoring the std:: for now):


Or this:

It's worth pointing out that these are different too:


Note that Es last output request is for a char, hence operator Fs case, the last is a const char[2], and so operator


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist