I
I
Ivan Ivanov2014-01-09 08:27:14
C++ / C#
Ivan Ivanov, 2014-01-09 08:27:14

What is the difference between /n and endl?

Still, there must be some difference, otherwise why create 2 identical functions? Maybe, like, 1 of them is inherited, etc. If so, then there is no difference at all what to use ???

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bak, 2014-01-09
@Csklassami

\n is not always a line break. endl is a more generic solution, guaranteed to work on all platforms. In addition, endl calls flush, which is needed for guaranteed writing (usually writing does not occur immediately, but is buffered).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question