+ 1
Difference between \n and endl.
I dont seem to understand the difference between /n and endl,in the beginning of sololearn c++ tutorials,They use endl,But in the textbook I have they use \n. What is the difference between them?Help of any sort is appreciated.Thanks for reading.
1 Respuesta
+ 3
Yes, they're different.
"\n" is just a string of length 1 that gets appended to stdout.
std::endl, instead, is an object that will cause to append the newline character ("\n") AND to flush stdout buffer. For this reason it will take more processing
-peoro at stackoverflow.com