write a program in c language for the multiplication of two
matrices using pointers?
Answer Posted / syed fakheruddin ahmad
main()
{
int mat1[3][3] = {1,2,3,4,5,6,7,8,9};
int mat2[3][3] = {1,2,3,4,5,6,7,8,9};
int res[3][3];
int i,j,k;
for (i=0; i<3; i++)
for (j=0; j<3; j++)
res[i][j] = 0;
for (i=0; i<3; i++)
for (j=0; j<3; j++)
for (k=0; k<3; k++)
*(*(res + i) + j) += (*(*(mat1 + i) + k)) * (*(*(mat2 + k)
+ j));
for (i=0; i<3; i++)
{
for (j=0; j<3; j++)
printf ("%d\t", res[i][j]);
printf ("\n");
}
printf("\n");
}
| Is This Answer Correct ? | 100 Yes | 45 No |
Post New Answer View All Answers
What is property type c?
hi... can anyone help me to make a two-dimensinal arrays in finding the sum of two elements plzzz. thnx a lot...
Why c is procedure oriented?
Explain function?
What is #include called?
the question is that what you have been doing all these periods (one year gap)
i want to know the procedure of qualcomm for getting a job through offcampus
How can I recover the file name given an open stream?
What are volatile variables in c?
What is return in c programming?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
How main function is called in c?
main() { printf("hello"); fork(); }
What is && in c programming?
Explain how do you determine the length of a string value that was stored in a variable?