The name of an array itself, where is it stored

前端 未结 4 1714
醉话见心
醉话见心 2021-01-20 16:37

How are the names of arrays stored in memory?

For example if I write:

char arr[10];

the array items are stored in memory starting f

4条回答
  •  無奈伤痛
    2021-01-20 16:56

    arr itself but also arr[0], arr[1]....arr[9] are all without addresses themselves.

    arr is simply the base address of the array. Individual elements are located by adding offsets to that address. The name of the array isn't useful, except for debugging, once the code is compiled.

提交回复
热议问题