#include <stdio.h>
int main()
{
struct site
{
char name[] = "GeeksQuiz";
int no_of_pages = 200;
};
struct site *ptr;
printf("%d ", ptr->no_of_pages);
printf("%s", ptr->name);
getchar();
return 0;
}
Answer: D
Correct answer: Compiler Error
A structure declaration describes a type, not an object, so its members cannot carry initialisers - both char name[] = "GeeksQuiz"; and int no_of_pages = 200; are rejected. A member array also cannot have an unspecified size. The program never compiles, so the uninitialised ptr never becomes an issue.
Please log in or register to report this question.