ProgrammingModerate

A 2D grid of 1000 x 1000 is stored as int g[1000][1000] global. Roughly how many bytes does it take with 4-byte int?

  1. A. About 1 MB
  2. B. About 40 MB
  3. C. About 4 GB
  4. D. About 4 MB, that is 4 000 000 bytes

Correct answer: D. About 4 MB, that is 4 000 000 bytes

1000 x 1000 = 10^6 ints of 4 bytes each, which is about 4 MB.

More C Programming questions

Exams that ask this topic