Я пытаюсь понять указатели и массивы.Пытаясь найти указатели в Интернете (каламбур!), Я констатирую свое замешательство здесь ..
//my understanding of pointers
int d = 5; //variable d
int t = 6; //variable t
int* pd; //pointer pd of integer type
int* pt; //pointer pd of integer type
pd = &d; //assign address of d to pd
pt = &t; //assign address of d to pd
//*pd will print 5
//*pt will print 6
//My understanding of pointers and arrays
int x[] = {10,2,3,4,5,6};
int* px; //pointer of type int
px = x; //this is same as the below line
px = &x[0];
//*px[2] is the same as x[2]
Пока я понял.Теперь, когда я делаю следующее и когда я печатаю pd [0], он показывает что-то вроде -1078837816.Что здесь происходит?
pd[0] = (int)pt;
Кто-нибудь может помочь?