Matrix Multiplication in C
This C program demonstrates matrix multiplication functionality. It generates random matrices of specified dimensions and multiplies them together, producing the resultant matrix.
The program performs the following steps:
- Randomly generates the dimensions of two matrices (r, c for the first matrix, and r1, c1 for the second matrix).
- Checks if the number of columns in the first matrix is equal to the number of rows in the second matrix for valid matrix multiplication.
- Dynamically allocates memory for the matrices and the resulting matrix (mul) with appropriate sizes.
- Assigns random integer values to the elements of both matrices.
- Performs matrix multiplication using nested loops and stores the result in the matrix mul.
- Prints the input matrices and the resulting matrix after multiplication.
matrix_mul.c: Contains the C code for the convolution program. README.md: Instructions and information about the program.
- Compile the C program using a C compiler. For example:
gcc matrix_mul.c
- Execute the compiled program:
./a.exe