what is wrong with this code? It shows segmentation fault
#include<stdio.h>
#include<stdlib.h>
void main()
{
int i,j,count=1;
int **a=(int**)malloc(3*sizeof(int*));
for(i=0; i<3; i++)
{
a[i]=(int*)malloc(4*sizeof(int));
}
for(i=0; i<3; i++)
{
for(j=0; j<4; j++)
{
a[i][j]=count; count++;
}
}
printf("\n");
for(i=0; i<3; i++)
{
for(j=0; j<4; j++)
{
printf("%d ",a[i][j]);
}
printf("\n");
}
}