R
Q. Predict the output of following program, assume that a character takes 1 byte and pointer takes 4 bytes.
Code:
#include <stdio.h>
int main()
{
char *str1 = "GeeksQuiz";
char str2[] = "GeeksQuiz";
printf("sizeof(str1) = %d, sizeof(str2) = %d",
sizeof(str1), sizeof(str2));
return 0;
}
int main()
{
char *str1 = "GeeksQuiz";
char str2[] = "GeeksQuiz";
printf("sizeof(str1) = %d, sizeof(str2) = %d",
sizeof(str1), sizeof(str2));
return 0;
}
- Correct Answer - Option(B)
- Views: 203
- Filed under category C Programming
Discusssion
Login to discuss.