-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpassArray2D.c
More file actions
40 lines (33 loc) · 885 Bytes
/
Copy pathpassArray2D.c
File metadata and controls
40 lines (33 loc) · 885 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
/*Author : Anna Tony
Date : 11-03-2025
Description : pass 2d array
Version : 1.0 */
#include <stdio.h>
void readMatrix(int[][10],int,int);
void printMatrix(int[][10],int,int);
int main(){
int row,col;
printf("\nEnter the row and column : ");
scanf("%d%d",&row,&col);
int matrix[row][col];
readMatrix(matrix,row,col);
printf("\nThe Matrix :\n");
printMatrix(matrix,row,col);
return 0;
}
void readMatrix(int matrix[][10],int row,int col){
printf("\nEnter the elements : ");
for(int i=0;i<row;i++){
for(int j=0;j<col;j++){
scanf("%d",&matrix[i][j]);
}
}
}
void printMatrix(int matrix[][10],int row,int col){
for (int i=0;i<row;i++){
for (int j=0;j<col;j++){
printf("%d\t",matrix[i][j]);
}
printf("\n");
}
}