> ^ This is wrong. Should be
>
> int **table1=malloc(10000000*sizeof(int**));
>
> The same error occurs several times.
>
> You also need
>
> if (!table1 || !table1_aux)
> perror ("");
>
LOL, you've got to be kidding us :)
"table1" is pointer to an array of (int *). That's why it has type (int **).
Alexey