int* myPointer = new int[100];
// ...
int firstValue = *(myPointer + 0);
int secondValue = myPointer[1];
Is there any functional difference betwe
Edit 1 : Decade old question. but still I think this answer will help knowing the compiler's perspective on processing array indexing
For the compiler they both are the same!
code 1
#include
int main()
{
int myArr[5] = {1, 2, 3, 4, 5};
int value = myArr[0];
}
code 2
#include
int main()
{
int myArr[5] = {1, 2, 3, 4, 5};
int value = *(myArr + 0);
}
These files if compiled with gcc -S flag, will produce the assembly code file with .s extension I compared both the .s files with kdiff3 and comparison shows they produced the same asm code.