Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is the value of a[4]?

int a[5]={1,2,4,1,0}

  • A.1
  • B.10
  • C.0
  • D.Error

Answer: C

Correct answer: 0

The initialiser list fills the array in order, so a[0] = 1, a[1] = 2, a[2] = 4, a[3] = 1 and a[4] = 0 - the last value in the list, since indexing starts at 0.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.