- #1
transgalactic
- 1,395
- 0
i can't understand why i get such an output??
the second line links the pointer *array_ptr with the value of cell "1"
but in the third line it should have print the address of cell "1"
not its value 89
i think that if i want to print cell one we need to change this line into
why i get the value of cell "1"
when by my logic i should get the adress of cell "1"
??
Code:
int array[] = { 45, 67, 89 }; //1st ine
int *array_ptr = &array[1]; //2nd line
printf("%i\n", array_ptr[1]); //3rd line
the second line links the pointer *array_ptr with the value of cell "1"
but in the third line it should have print the address of cell "1"
not its value 89
i think that if i want to print cell one we need to change this line into
Code:
printf("%i\n",*array_ptr[1]);
when by my logic i should get the adress of cell "1"
??