What exactly is the array name in c?

前端 未结 6 952
无人共我
无人共我 2020-11-22 10:47

I am having a tough time understanding the type and use of the name of the array in C. It might seems a long post but please bear with me.

I understand that the foll

6条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 11:05

    a and &a have the same value because a long time ago you were required to use the address operator & on arrays to get the array's address, but it is no longer necessary. The name of the array (a in this case) these days just represents the memory address of the array itself, which is also what you get from &a. It's a shorthand that the compiler handles for you.

提交回复
热议问题