What 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;
}
Answer: D
str is null terminated but ary is not.
Output:
$ cc pgm7.c
$ a.out
1 5