Single Choice
Not Set
QWhat is the output of this C code?
#include
#include
int main()
{
char *str = "x";
char c = 'x';
char ary[1];
ary[0] = c;
printf("%d %d", strlen(str), strlen(ary));
return 0;
}
ID: #1365
Constant in C Language
2,699 views
Question Info
#1365Q ID
Not SetDifficulty
Constant in C LanguageTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
str is null terminated but ary is not.
Output:
$ cc pgm7.c $ a.out 1 5
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic