O_oI was taught that the array name is a pointer to the array. If its not then why can we access an array using a pointer of arrays name?
You were taught with, at best, misleading language.
An array is an array.
A pointer is a pointer.
The identifier, the variable name, of an array may be used where a compatible pointer is expected because the standard requires the behavior of the array being implicitly converted to the compatible pointer. We largely speak of the array "decaying" into a pointer because the array has behavior a real pointer does not exhibit.
You can explore this yourself by adding a compatible pointer, `sizeof', and "address of" (&) to your test.
Soma