p =数组是否与p =& array [0]相同? [英] Is p = array the same as p = &array[0]?
本文介绍了p =数组是否与p =& array [0]相同?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int numbers[20];
int * p;
下面的两个作业是否相同?
Are the two assignments below the same?
p = numbers;
p = &numbers[0];
推荐答案
是的.
在这种情况下,数组的名称衰减为指向其第一个元素的指针.
In this case, Name of the array decays to a pointer to its first element.
因此
p = numbers; //Name of the array
与:
p = &numbers[0]; //Address of the First Element of the Array
这篇关于p =数组是否与p =& array [0]相同?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文