Why two strings are of two sizes? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
18th Apr 2020, 4:53 AM
Dipra Irham
Dipra Irham - avatar
4 Answers
+ 1
The second one technically is not a string because you don't have '\0' after it, while '\0' is added at the end of first one.
18th Apr 2020, 5:07 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
CarrieForle If the 2nd one isn’t string, then what is it?Wasn’t the compiler supposed to put a '\0' at the end of 2nd string?
18th Apr 2020, 5:11 AM
Dipra Irham
Dipra Irham - avatar
+ 1
Second one is array of characters. Because the complier sees it as an array, \0 won't be added
18th Apr 2020, 6:01 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Now I get it.
18th Apr 2020, 8:33 AM
Dipra Irham
Dipra Irham - avatar