- 2
main() {intarr[]={1,2,3,4,5}; int *ptr, i; ptr=arr+4; for(i=0;i<5;i++) printf(“\n%d”,*(ptr-1)); }
I am getting 20 as a answer, is it correct? Is the output correct? If not then how to solve?
2 ответов
+ 2
You can use code module on SoloLearn to test your codes. This module is for asking your problems related to programming and related stuffs.
Thank you
+ 1
How?
Not correct..
..
Edit:
I think you are not mentioned your doubt clearly.. If any mention it..
Edit:?
ptr=arr+4 ; by this ptr points to last value 5.
Next your output *(ptr-1) always points to 4.
So 4 printed in 5 times..