I have a function in C language which takes 3 matrices as arguments; It performs matrix multiplication of first 2 matrices and stores the result in the 3rd one.
My question is what should I return from the function. Should I return the resultant matrix it self (rather the pointer to it) so that function calls can be chained togather like so :
display_matrix(multiply_matrix(A, B, C));
Or should I return 0 or 1 based on whether the operation was successful or not (incorrect dimensions might return failure)? In this case the line shown above would look something like this.
multiply_matrix(A, B, C);
display_matrix(C);
So, what would be the better way to do it? Or is it just a matter of choice?