forked from MukulCode/CodingClubIndia
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ02_MatrixUsingDMA.c
More file actions
40 lines (39 loc) · 848 Bytes
/
Q02_MatrixUsingDMA.c
File metadata and controls
40 lines (39 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <stdio.h>
#include <stdlib.h>
int main()
{
int m, n;
printf("Enter the size of the matrix:");
scanf("%d%d", &m, &n);
int **arr;
arr = (int **)malloc(m * sizeof(int *));
for (int i = 0; i < m; i++)
{
arr[i] = (int *)malloc(n * sizeof(int));
}
printf("\nEnter the element of the matrix\n");
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
scanf("%d", &arr[i][j]);
}
}
printf("\nInput Matrix\n");
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
printf("%d ", arr[i][j]);
}
printf("\n");
}
for (int i = 0; i < m; i++)
{
free(arr[i]);
arr[i] = NULL;
}
free(arr);
arr = NULL;
return 0;
}