#include #include int main(int argc, char *argv[]) { int i; int *x = malloc(sizeof(int) * 6); // add 0 to x, dereference the result and put the value 1 x[0] = 1; // add 1 * sizeof(int) to x, dereference the result and put the value 2 *(x+1) = 2; // add i (2) to x, dereference the result and put the value 3 i = 2; x[i] = 3; // add 3 * sizeof(int) to the address x, dereference the result and put 4 i++; i[x] = 4; // add 4 * sizeof(int) to the address x, dereference the result and put 5 i++; *(x + i) = 5; // add 5 * sizeof(int) to the address x, dereference the result and put 6 x += 5; *x = 6; // subtract 5 * sizeof(int) from x and then use x as an array x -= 5; printf("%d %d %d %d %d %d\n", x[0], x[1], x[2], x[3], x[4], x[5]); free( x ); // is the data still there? printf("%d %d %d %d %d %d\n", x[0], x[1], x[2], x[3], x[4], x[5]); return(0); }