Question discussion

What will be printed after execution of the following code?void main(){ int arr[10] = {1,2,3,4,5}; printf("%d", arr[5]);}

287517Medium 1 reply 2,082 views
25
What will be printed after execution of the following code?void main(){ int arr[10] = {1,2,3,4,5}; printf("%d", arr[5]);}
  • AGarbage Value
  • B5
  • C6
  • D0
  • ENone of these
Correct answer: D

Discussion 1

0
CCommunity
0

When an array is partially initialized at the time of declaration then the remaining elements of the array is initialized to 0 by default.