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
Explain what is the benefit of using enum to declare a constant?
write a c program for swapping two strings using pointer
Which function in C can be used to append a string to another string?
What are static variables in c?
write a proram to reverse the string using switch case?
Hi how many types of software editions are there and their difference (like home editions, enterprise, standard etc) can u please help me
Explain what happens if you free a pointer twice?
What is pointers in c?
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
How can I write a function that takes a format string and a variable number of arguments?
What is a built-in function in C?
Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc
Explain a file operation in C with an example.
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
Why c language?