[prev] [index] [next]

Array Storage

What exactly does an array declaration produce in memory?

An array declaration   T a[N];    (where T is a type; N is a count)

  • allocates a region of memory of size N×sizeof(T)
  • associates name a with address of first element
E.g.   char buf[100];
  • allocates of a region of memory to hold 100 chars (i.e. 100-byte block)
  • associates name buf with address of first char in this region