String a="Hello, World!" ;
Cout
The output is 4
(2)
Cout
The output is 14
Excuse me: why not?
CodePudding user response:
The first is a the size of the object, the second is the length of the stringCodePudding user response:
Because a is an instance of the string class, sizeof on his are the sizeof the entire string class, not just strings,Below that will direct to sizeof so string can be obtained by sizeof the length of the string
CodePudding user response:
Because of the Hello, World! [13] + [1] '\ 0'=14CodePudding user response:
The first is the size of the variable type, the second is the length of the string,