int A;
int* pA = 1;
int Vect[2] = {1,2};
int* pVect;
pA = &A;
*pA = 2;
pVect = Vect;
pVect[0] = 10;
In the case I have a pointer to a variable and then to a vector, and I want to change its values by the pointer. Why is there such a divergence in address passing (in the variable I have to use &
and in the vector does not need)? Is this proper to C language?
As far as I know the pointer, it points to the memory address of that variable obtained by &
, but for vector it does not need &
.