Here is an example code:
int* arr = (int*)malloc(2 * sizeof(int));
arr = arr + 1;
*arr = 11;
arr[-1] = 22;
int x = arr[0]; // x = 11
int y = arr[1]; // y = 194759710
After a memory allocation arr
pointer is incremented. I have expected to get the following results:
x == 22
y == 11
Could you explain how it works ?