If int a[10] is declared and an int occupies 4 bytes, what is the total size of array a?
Options
- A. 10 bytes
- B. 14 bytes
- C. 40 bytes
- D. More than one of the above
- E. None of the above
Quiz Practice:
C. 40 bytes
Answer: (C) 40 bytes
The total memory required by an array is:
Number of elements × size of each element
Here:
Number of elements = 10
Size of each int = 4 bytes
Therefore:
10 × 4 = 40 bytes
So the array occupies 40 bytes under the size assumption given in the question.