I was reading code for addition of sparse matrix and came across this condition
if( sp1 != sp2 || sp1 != sp2 )
printf("Invalid matrix size ");
In matrix addition the number rows in the first matrix need to equal the number of rows in the second matrix.
The same is true about the columns.
The number of columns of the first matrix has to equal the number of columns of the second.
That is what that code you posted shows. Here is a quote from the linked code:
In this matrix sparse matrix is stored as follows
s=Total rows in sparse matrix
s=Total columns in sparse matrix
s=Total number of non-zero values