Because you have not allocated your memory properly. What you actually have done is allocate only the rows of your table. You have not allocated any space for the columns, but you still try to access them and this will cause undefined behavior. In order to fix it, replace the part :
tab = (int **)malloc(sizeof(int *) * 100);
tab[i][j] = 5;
with :
tab = malloc(sizeof(int *) * 100);
for (i = 0; i < 100; i++)
tab[i] = malloc(sizeof(int) * NUM) ; //where NUM is the size you want to allocate
tab[i][j] = 5;
Take a look at this link to understand how the memory allocation for pointer to pointer works.
Also, see why you should not cast the result of malloc.