Why is endl used?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is endl used??

20th Mar 2018, 2:34 PM
Hardik
Hardik - avatar
5 Answers
+ 8
A concise answer provided by @Ace in this thread: https://www.sololearn.com/Discuss/1111250/?ref=app
20th Mar 2018, 2:48 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Assuming you are talking about C++, 'endl' is used to specify the end of a line Example: int main() { cout << "Hello World!"; cout << "C++ is awesome!"; } Output: Hello World!C++ is awesome! Using endl: int main() { cout << "Hello World!" << endl; cout << "C++ is awesome!"; } Output: Hello World! C++ is awesome! Other ways to do this are: cout << "Hello World!" << "C++ is awesome!"; OR cout << "Hello World!\nC++ is awesome!"; Let me know if I can clear any doubts :)
20th Mar 2018, 2:57 PM
Just A Rather Ridiculously Long Username
+ 1
endl is a manipulator instead of \n
27th Mar 2018, 2:06 PM
Amrutha Addala
Amrutha Addala - avatar
+ 1
endl is a manipulator..used to print newline
2nd Apr 2018, 5:15 PM
Nandigama Srinivas
Nandigama Srinivas - avatar
+ 1
Endl is used to skip or print a new line to output on the compiler
3rd Apr 2018, 1:29 PM
Themba Nyembe
Themba Nyembe - avatar