Difference Between *(Pointer + Index) and Pointer[]

后端 未结 8 2210
日久生厌
日久生厌 2020-11-27 03:56
int* myPointer = new int[100];

// ...

int firstValue = *(myPointer + 0);
int secondValue = myPointer[1];

Is there any functional difference betwe

8条回答
  •  感动是毒
    2020-11-27 04:38

    There is no difference between

    *(array+10); //and
    array[10];
    

    but guess what? since + is commutative

     *(10 + array); //is all the same
     10[array]; //! it's true try it !
    

提交回复
热议问题