Matrix Calculator Using Dynamic Allocation
Mini Project 3 C Programming
Name : Dileepan.R
Roll No : 25BSC014
Dept : CSE (Cyber security )
Class : 1 Year
Slide 1 3 Title Slide
Matrix Calculator Using Dynamic Allocation
Mini Project 3 C Programming
Uses int** pointers
Performs matrix operations dynamically
Demonstrates memory management in C
Prepared by: Your Name Department / Class
Slide 2 3 Introduction
What is a Matrix Calculator?
A matrix is a rectangular array of numbers
A matrix calculator performs operations like:
Addition
Subtraction
Multiplication
Transpose
This project uses dynamic memory allocation instead of fixed arrays
Why Dynamic Allocation?
Matrix size can be decided at runtime
Efficient memory usage
Slide 3 3 Concept of Dynamic Memory Allocation
Dynamic Memory in C
Memory is allocated during program execution
Functions used:
malloc() 3 allocates memory
free() 3 releases memory
int** is used to create 2D matrices dynamically
Advantages
Flexible matrix size
Better memory control
Suitable for large matrices
Slide 4 3 Matrix Representation using int**
How Matrix is Created
int** matrix ³ pointer to pointer
Memory allocation steps:
a. Allocate memory for rows
b. Allocate memory for columns for each row
Example Concept
matrix[i][j] accesses elements
Works same as normal 2D array
Slide 5 3 Matrix Operations Implemented
Operations in This Project
Matrix Addition Matrix Subtraction
Adds two matrices of same order Subtracts corresponding elements
Matrix Multiplication Matrix Transpose
Rows of first × Columns of second Converts rows into columns
Slide 6 3 Working of the Program
Program Flow
01 02
User enters number of rows and columns Memory is allocated dynamically
03 04
User enters matrix elements User selects operation:
Add / Subtract / Multiply / Transpose
05 06
Result is displayed Allocated memory is freed
Slide 7 3 Advantages & Applications
Advantages Applications
Dynamic matrix size Scientific calculations
Efficient memory utilization Engineering problems
Reusable code using functions Image processing
Machine learning basics
Slide 8 3 Conclusion
Conclusion
Matrix Calculator demonstrates: Key Learnings
Use of int** Helps understand pointers and memory
Dynamic memory allocation management in C
Matrix operations Useful mini project for academic learning
Program :
OUTPUT :