Can someone tell me the difference between cout <<"" and cout << <<endl; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can someone tell me the difference between cout <<"" and cout << <<endl;

24th Nov 2018, 9:12 PM
Faruq
Faruq - avatar
2 Answers
+ 4
cout << ""; writes an empty string to the output buffer. cout << << endl; is just a syntax error. You cannot opt to print "nothing" like that, since you omitted an argument for <<, which requires both LHS and RHS arguments to work.
25th Nov 2018, 1:06 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
std::endl writes '\n' and flushes the terminal
24th Nov 2018, 9:53 PM
'Paul
'Paul - avatar