in c, when allocating a new dynamic memory with malloc:
int* x = (int*)malloc(sizeof(x));
int y = 10;
is this line:
*x = y;
equal to this line:
x[0] = y;
in c, when allocating a new dynamic memory with malloc:
int* x = (int*)malloc(sizeof(x));
int y = 10;
is this line:
*x = y;
equal to this line:
x[0] = y;
The definition of the [] operator is: given ex1[ex2], it is guaranteed to be equivalent to
*((ex1) + (ex2))
Where ex1 and ex2 are expressions.
In your case x[0] == *(x + 0) == *(x) == *x.
See Do pointers support "array style indexing"? for details.