#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; } |
chevron_right
filter_none
(A) 200 GeeksQuiz
(B) 200
(C) Runtime Error
(D) Compiler Error
Answer: (D)
Explanation: When we declare a structure or union, we actually declare a new data type suitable for our purpose. So we cannot initialize values as it is not a variable declaration but a data type declaration.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C | Structure & Union | Question 2
- C | Structure & Union | Question 10
- C | Structure & Union | Question 4
- C | Structure & Union | Question 5
- C | Structure & Union | Question 6
- C | Structure & Union | Question 7
- C | Structure & Union | Question 8
- C | Structure & Union | Question 9
- C | Structure & Union | Question 10
- Output of C programs | Set 44 (Structure & Union)
- Anonymous Union and Structure in C
- Output of C++ programs | Set 41 (Structure and Union)
- C | Loops & Control Structure | Question 1
- C | Loops & Control Structure | Question 2
- C | Loops & Control Structure | Question 3
- C | Loops & Control Structure | Question 4
- C | Loops & Control Structure | Question 5
- C | Loops & Control Structure | Question 6
- C | Loops & Control Structure | Question 7
- C | Loops & Control Structure | Question 8

