string type max lenght

Hi, last week i found that i can define a variable as a string type, ans this will be the same that a char vector (char name[length]), but with the teacher and class, we want to know when you define a string type, what's its length, i found this article <http://www.cplusplus.com/reference/string/string/max_size/> (but for a string object), it says max_size = 4294967291, if this is true (and the same for a variable/constant) this is the max. allowed chars?

Thanks :D
No, that's the value in that particular language implementation. The value is not guaranteed to be anything. It could be that, or it could be 2^64-1, or 255.
Read better what that articles says:

A possible output for this program could be:
size: 11
length: 11
capacity: 15
max_size: 4294967291
Essentially the max_size seems to be close to the numeric limit for the type used to hold the length field. If the length was stored within the class as a 32 bit unsigned integer then the max_size appears to the numeric limit of the 32 bit integer although it is 4 bytes less then 2^32-1. I'm not sure I understand the significance of that. The point is obviously that the max_size cannot be any bigger then what can be stored in the class's length attribute.
Thanks a lot :)
Topic archived. No new replies allowed.