Predict the output or error(s) for the following:
1)
main()
{
char *str1="abcd";
char str2[]="abcd";
printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
}
Answer:
2 5 5
Explanation:
char *str1="abcd";
char str2[]="abcd";
printf("%d %d %d",sizeof(str1),sizeof(str2),sizeof("abcd"));
2 5 5
char *p;
printf("%d %d ",sizeof(*p),sizeof(p));