Both the endl and '\n' are used to start a new line in C++ program, But there is a little difference between these two commands. N is a string of length 1 that get appended to namespace std . On the other hand endl flushes the buffer . In this case the main advantage of endl is that if the program crashed the stuff get printed.But if you are using just to jump in new line with endl it consume the processing power and reduce the efficiency of the program.
- Blogger Comment
- Facebook Comment
Subscribe to:
Post Comments
(
Atom
)
0 comments:
Post a Comment