Write a program to pass a matrix as an argument to a function and display the matrix in the function
Answers
Answered by
2
Answer:
#include <stdio.h>
const int M = 3;
const int N = 3;
void print(int arr[M][N])
{
int i, j;
for (i = 0; i < M; i++)
for (j = 0; j < N; j++)
printf("%d ", arr[i][j]);
}
int main()
{
int arr[][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
print(arr);
return 0;
}
Similar questions
Math,
6 months ago
Computer Science,
6 months ago
English,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Math,
1 year ago
Science,
1 year ago