Below is the function I copied to get the answer...so plz do tell us the simple method for this.....
int ** addmatrix(int **a,int x1,int y1,int **b,int x2,int y2)
{
int i,j,**c;
c=(int**)malloc(x1*sizeof(int*));
for(i=0;i<x1;i++)
*(c+i)=(int*)malloc(y1*sizeof(int));
if(x1==x2 && y1==y2)
for(i=0;i<x1;i++)
for(j=0;j<y1;j++)
*(*(c+i)+j)=*(*(a+i)+j)+*(*(b+i)+j);
return(c);
}