Write a routine to find product of two sparse matrices
void sparse::product(sparse &a,sparse &b)
{
int sum,k,position,posi,flaga,flagb;
k=1;
result=new int[MAX SIZE *3];
for(int i=0;i<*(a.sp+0*3+0);i++)
{
for(int j=0;j<*(b.sp+0*3+1);j++)
{
serchina(a.sp,i,&position,&flaga);
if(flaga==TRUE)
{
sum=0;
while(*(a.sp+position*3+0)==i)
{
searchinb(b.sp,j,*(a.sp+position*3+1),&posi,&flagb);
if(flagb==TRUE)
sum=sum+*(a.sp+position*3+2)**(b.sp+posi*3+2);
position=position+1;
}
if(sum!=0)
{
*(result+k*3+0)=j;
*(result+k*3+1)=j;
*(result+k*3+2)=sum;
k=k+1;
}
}
}
}
*(result+0*3+0)=*(a.sp+0*3+0);
*(result+0*3+1)=*(b.sp+0*3+1);
*(result+0*3+2)=k-1;
}