DEV Community

yeonseong
yeonseong

Posted on

'\n' vs endl in Cpp

std::cout << '\n';
Enter fullscreen mode Exit fullscreen mode

just inserts a new line in cout buffer

std::cout << endl;
Enter fullscreen mode Exit fullscreen mode

inserts a new line in cout buffer, and flushes the cout buffer(a.k.a stream)

Top comments (0)