LearnFrenzy
Sign in Take a free test

Declarations and Initializations · Declarations MCQ · Question 10

int a[5] = {1}; – what is a[3]? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 10 Back to Exercise

After int a[5] = {1}; inside a function, what is a[3]?

  • A 1
  • B 0 Correct
  • C Garbage
  • D It does not compile
Correct Answer: Option B

Once an aggregate has an initializer, every element not explicitly initialised is set to zero – also for local arrays.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links