C Programming :: String - Discussion
Home > C Programming > String > MCQs Questions Discussion
23 / 26
What is the output of the following 'C' program ?
#include<stdio.h>
int main()
{
char a[] = "world";
printf("%d %d\n",strlen(a),sizeof(a));
return 0;
}
#include<stdio.h>
int main()
{
char a[] = "world";
printf("%d %d\n",strlen(a),sizeof(a));
return 0;
}
A5,5
B6,5
C5,6
D6,6
Answer: Option (Login/Signup)
Show Explanation
Next, sizeof() operator is used which prints the no. of characters in the character arrar + the '\0' (termination) character, here which is equal to 6.
Hence, the output is 5,6.
Asked In ::
STEP-BY-STEP
strlen() method prints the no. of characters in the character array, here which is 5.
Next, sizeof() operator is used which prints the no. of characters in the character arrar + the '\0' (termination) character, here which is equal to 6.
Hence, the output is 5,6.
Read Full Answer
Report Error
Please Login First Click Here