0
Why sizeof("xyz") is 4?
whenever passing a string of length 'l' in the sizeof() operator it returns the length of string + 1. How is it working for strings?
3 Answers
+ 11
Because it is null terminated.
+ 5
Whenever we use double quotes it means Compiler treats it as a string.
At the end of string there is always a null character i.e. \0
So including it,the result becomes 4
+ 1
Cool, So it was null character i am missing.
thaknx @abhishek and @helioform