Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program ? #include<stdio.h> int main() { char str[] = "India\0BIX\0"; printf("%d\n", sizeof(str)); return 0; } ?->(Show Answer!)
1. What will be the output of the program ? #include<stdio.h> int main() { char str[] = "India\0BIX\0"; printf("%d\n", sizeof(str)); return 0; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.02 pm
The following examples may help you understand this problem: 1. sizeof("") returns 1 (1*). 2. sizeof("India") returns 6 (5 + 1*). 3. sizeof("BIX") returns 4 (3 + 1*). 4. sizeof("India\0BIX") returns 10 (5 + 1 + 3 + 1*).
Here '\0' is considered as 1 char by sizeof() function. 5. sizeof("India\0BIX\0") returns 11 (5 + 1 + 3 + 1 + 1*).
Here '\0' is considered as 1 char by sizeof() function.
Here '\0' is considered as 1 char by sizeof() function. 5. sizeof("India\0BIX\0") returns 11 (5 + 1 + 3 + 1 + 1*).
Here '\0' is considered as 1 char by sizeof() function.