+ 2
Is there any difference between \n and endl ?
6 Answers
+ 8
Yes, there is. While std::cout << "\n" only adds the newline character to the standard output stream, std::endl also flushes the stream.
+ 3
simple terms: /n is used to end a line within a quote, whereas endl requires you to end quotes before using it.
for an example:
cout>>"hello my name is /n sally";
will create the new line within the quote, whereas
cout>>"hello my name is">>endl>>"sally";
is a bit more typing.
hope this helps! :D
0
\n is alternative method of endl..only difference is /n is use for every word in new line ...
0
\n for new line and endl is used to end the line I.e you cannot add anything on that line apart from your input data
0
endl basically ends a line nd further starts new line like we apply full stop in eng nd start next line .....
whereas \n is to start from new line
basically they r same but endl terminates nd start whereas \n just starts
- 1
Ń ŃŃŃŃĐșĐžĐč