Quote:
Why doesn't the compiler show an error for *marks being used as marks[I]?
Because the language definition says that the name of an array is a pointer to the first element. So
marks
is both a pointer and an array t the same time; the usage is available either way you declare it.
int arr[10];
int i1 = arr[0];
int i2 = *arr;
Is all valid, as is:
int *arr = (int*) malloc(40);
int i1 = arr[0];
int i2 = *arr;