0

What I guessed is that in p[-i] it takes the ith position from current pointing one towards the left-hand side.I am just a beginner so is there something more to it.

     #include<stdio.h>
     int main() {
     int arr[ ]={0,1,2,3,4};
     int *p,i;mm
        for(p=arr+4, i=0;i<=4;i++)
            printf("%d" , p[-i]);//43210
      }

1 Answers1

0

p is the pointer to the end of array. So p-i is the pointer to the ith position in the array to the left of p. This p[-i] is the element at that position.

Kaveh Vahedipour
  • 3,412
  • 1
  • 14
  • 22