-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray_function.c
More file actions
37 lines (28 loc) · 790 Bytes
/
array_function.c
File metadata and controls
37 lines (28 loc) · 790 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
#include <stdio.h>
void Accept(int rows, int cols, int arr[rows][cols]) {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
printf("Enter the value of %d row %d column: ", i+1, j+1);
scanf("%d", &arr[i][j]);
}
}
}
void display(int rows, int cols, int arr[rows][cols]) {
for (int i = 0; i < rows; i++) {
for (int j = 0; j < cols; j++) {
printf("%d\t", arr[i][j]);
}
printf("\n");
}
}
int main() {
int rows, cols;
printf("Enter the rows of the array: ");
scanf("%d", &rows);
printf("Enter the columns of the array: ");
scanf("%d", &cols);
int arr[rows][cols];
Accept(rows, cols, arr);
display(rows, cols, arr);
return 0;
}