Well the main() thing is really basic. But the reason you are having problems is because of this:
Code:
int **x = (int **)malloc(2 * sizeof(int *));
/*this allocates an array of pointers (2 pointers to be exact*/
x[0] = (int *)malloc(sizeof(int));
x[1] = (int *)malloc(sizeof(int));
/*this allocates the actual ints that you are going to work with*/
The point is that you are not allocating the memory required to an operation like
x[0][1] = 65;
You are must do the second malloc() or calloc().
Code:
int **x = (int **)calloc(2, sizeof(int *));
x[0] = (int *)calloc(1, sizeof(int));
x[1] = (int *)calloc(1, sizeof(int));