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 getch() function?
What does the && operator do in a program code?
What is meant by recursion?
Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.
What is difference between class and structure?
What is wrong with this code?
How do I swap bytes?
Is c easier than java?
What is an array in c?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
In C language, a variable name cannot contain?
What do you mean by dynamic memory allocation in c?
Why do we need volatile in c?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
How do you define a function?