+ 1
Why the outpt of size of operator is 20 here,when we assign a string in the array?
char s[20] = "Hello\0Hi" printf("%d %d",strlen(s),sizeof(s)); O/P :- 5 20
1 ответ
+ 2
The strlen function will count the number of characters inside a string until a null terminator is encountered, and then return that count. While sizeof operator is done compile-time, so if you declare an array with known-bound, sizeof operator will return that bound size