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
Who developed c language?
What is the use of pragma in embedded c?
Is void a keyword in c?
Why is c so important?
What is the use of gets and puts?
Why can’t constant values be used to define an array’s initial size?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
Do string constants represent numerical values?
Is c procedural or object oriented?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
Is c weakly typed?
Which is best linux os?
How can I convert a number to a string?
Explain what is the concatenation operator?
What is a macro in c preprocessor?