+ 3
What are three major differences in between \n and endl?
2 Antworten
+ 8
https://www.google.com/amp/s/www.geeksforgeeks.org/endl-vs-n-in-cpp/amp/
endl is manipulator while \n is character.
endl doesn’t occupy any memory whereas \n is character so It occupy 1 byte memory.
We cannot write endl in between double quotation while we can write \n in between double quotation like
cout<<"\n"; it is right but cout<<"endl"; is wrong.
We can use \n both in C and C++ but, endl is only supported by C++ and not the C language.
Hope this helpful! Programming is fun! 😄🤗
+ 1
\n is a character , endl is not
endl is slow , \n is not
endl flushes the Ouput buffer , nothing so with \n