- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between "std::endl" and "n" in C++?
"\n" Outputs a newline (in the appropriate platform-specific representation, so it generates a "\r\n" on Windows), but std::endl does the same AND flushes the stream. Usually, you don't need to flush the stream immediately and it'll just cost you performance, so, for the most part, there's no reason to use std::endl.
When you want to flush the stream manually because you expect your output to be made visible to the user in a timely manner(ie without delay), you should use std::endl instead of writing '\n' to the stream.
- Related Articles
- What is the difference between "std::endl" and "\n" in C++?
- Comparison between endl and \n in C++
- Difference between std::vector and std::array in C++
- Why we should avoid using std::endl in C++
- What are the differences between -std = c++11 and -std = gnu++11?
- Difference between Relational operator(==) and std::string::compare() in C++
- What is the difference between jQuery.offsetParent( ) and njQuery.offset( ) in jQuery?n
- What is the difference Between C and C++?
- What is the difference between | and || operators in c#?
- What is difference between self and __init__ methods in python Class?\n\n
- What is the difference between JavaScript and C++?
- What is the difference between printf() and cout in C++?
- What is the difference between size_t and int in C++?
- What is the difference between Task.WhenAll() and Task.WaitAll() in C#?
- What is the difference between Monitor and Lock in C#?
- What is the difference between ++i and i++ in c?

Advertisements