Reputation: 183
I am learning C++, so you are very right to assume that I am new to C++ and programming as well.
I am trying to understand iostream
library, not the whole, but the things that newcomers must know before jumping into another topic. My understanding of std::cout
is that it is a variable that holds bunches of chars or value of other variables for outputting into the console.
Now I am curious to know maximum number of chars as a string--giving directly(like std::cout <<"hello\n"
--it(std::cout) can output to the console.
Upvotes: 1
Views: 1026
Reputation: 87997
Your understanding of std::cout
is not quite correct. std::cout
is a variable but it doesn't hold characters, it outputs characters(typically to the console).
Now std::cout
is usually buffered, which means it doesn't output characters immediately but only when its buffer is full or when it has a complete line of characters. But this process happens automatically, and I don't think that is quite what you meant by 'holds chars'.
Upvotes: 2
Reputation: 238411
There is no specified limit. There may be a practical implementation specific limit. Most likely, it will be way more than you'll need.
Note that std::cout
streams to standard output. While that is often displayed in console, that is not necessarily the case.
Upvotes: 3