

Strings - Programming
Q1: What will be the output of the program ?
#include<stdio.h>
int main()
{
char str[] = "India\0Aptitude\0";
printf("%d\n", sizeof(str));
return 0;
}
A 10
B 6
C 5
D 11
ANS:D - 11 The following examples may help you understand this problem:
1. sizeof("") returns 1 (1*).
2. sizeof("India") returns 6 (5 + 1*).
3. sizeof("Aptitude") returns 4 (3 + 1*).
4. sizeof("India\0Aptitude") returns 10 (5 + 1 + 3 + 1*). |


For help Students Orientation
Mcqs Questions
One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.