a,& a,第一個元素a [0]的地址與有區別是什麼? 類似地,p是一個指向一個整數的指針,但被指定爲數組地址。 該指針[]會執行指針算術並根據數據類型獲取值嗎? 進一步指望*有什麼價值?它應該是一個指針嗎?指針 - 數組與指針的區別
#include<stdio.h>
int main()
{
int a[]={5,6,7,8};
int *p= a;
printf("\nThis is the address of a %u, value of &a %u ,Address of first element %u , Value pointed by a %u",a,&a,&a[0],*a);
printf("\nThis is the address at p %u , value at p %u and the value pointed by p %d",&p,p,*p);
printf("\n");
}
This is the address of a 3219815716, value of &a 3219815716 ,Address of first element 3219815716 , Value pointed by a 5
This is the address at p 3219815712 , value at p 3219815716 and the value pointed by p 5
READ C-FAQ專門部6問:6.12 [鏈接](HTTP:// C -faq.com/aryptr/index.html) –
http://stackoverflow.com/questions/26149426/how-can-an-address-have-multiple-values閱讀這個問題的答案... – Hari