After a long day of coding i accidentaly wrote
cout << "some text" << cout;
instead of
cout << "some text" << endl;
Now it printed out a memory address. What does it point to ?
The "c" in cout refers to "character" and "out" means "output". Hence cout means "character output".
Standard output stream (cout): Usually the standard output device is the display screen. The C++ cout statement is the instance of the ostream class. It is used to produce output on the standard output device which is usually the display screen.
It is used to display the output to the standard output device i.e. monitor. It is associated with the standard C output stream stdout. The data needed to be displayed on the screen is inserted in the standard output stream (cout) using the insertion operator(<<).
There are two variables (among others) defined in <iostream>. cout is used for output, cin for input.
std::cout
is an instance of std::ostream
, and, before C++11, that had a conversion operator to void*
. It seems your code is triggering that conversion, giving you the address of the std::cout
object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With