What happens to the remaining elements when an integer array is partially initialized using a brace-enclosed initializer?

Options

  • A. They contain unpredictable values in every case
  • B. They are initialized to zero
  • C. The array declaration always gives a compile-time error
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. They are initialized to zero

Detailed Explanation

Correct Answer: Option B

Explanation: When an array is initialized with fewer values than its declared size, the remaining elements are initialized to zero. For example, int a[5] = {1, 2}; results in {1, 2, 0, 0, 0}.