Scusa, ma cosa intendi fare con

mat=calloc(n,sizeof(int));