Does an Array variable point to itself?

前端 未结 4 1816
猫巷女王i
猫巷女王i 2021-01-23 11:14

I tried some code to check the behavior of array and pointers. Its as follows.

#include 
main(){
int s[]={1,2};
int *b=s;
printf(\"%d, %d, %d\\n\"         


        
4条回答
  •  [愿得一人]
    2021-01-23 11:45

    An array, when used as an argument to a function, decays into a pointer to its first element. Similarly, taking the address of an array results in a pointer to the location of the first element (but with a different type).

    As for your second question, a variable name only exists at compile-time. It typically has no representation in memory at runtime.

提交回复
热议问题