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

Discussion

How many elements does the array below have?

int a[20]

 

  • A.22
  • B.21
  • C.20
  • D.19

Answer: C

Correct answer: 20

The number in the declarator is the count of elements, so int a[20] has 20 of them, with subscripts 0 to 19. Do not confuse this with the number of bytes, which would be \(20 \times \text{sizeof(int)}\).

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

Post your comment

Please log in or register to post a comment.