We have a three-byte array like below:
char charArray[3];
charArray[1]='a';
//or
char * charP=charArray;
charP[1]='a';
Two methods are used to access to second element of array, now will they be implemented in the same way by compiler or the first method will not involve a pointer like second method?
will they be implemented in the same way by compiler
Maybe.
If you use the name of an array and the subscript is a constant expression, a compiler can probably do some or all of the pointer arithmetic at compile-time. It might not be able to do the same using a pointer to an array; that probably depends on whether or not the compiler can tell for sure that the pointer points to an element in the array.
This is just speculation, though. The only way to tell for sure whether a given compiler emits the same code for both is to look at the code emitted by that compiler.