Passing a matrix in a function C
void ins (size_t rows, size_t columns, int matrix[rows][columns]);
Passing a matrix in a function C
void ins (size_t rows, size_t columns, int matrix[rows][columns]);
passing 2d array as parameter to function in c
#include <stdio.h>
//passing 2D array as a parameter to a function
void fun(int *arr, int m, int n)
{
int i, j;
for (i = 0; i < m; i++){
for (j = 0; j < n; j++)
printf("%d ", *((arr+i*n) + j));
printf("\n");
}
}
int main(void)
{
int arr[][4] = {{1, 2, 3,4}, {4, 5, 6,7}, {7, 8, 9,0}};
int m = 3, n = 4; //m - no.of rows, n - no.of col
fun(&arr, m, n);
return 0;
}
Passing a matrix in a function C
void ins (int (*matrix)[100], int row, int column);
Passing a matrix in a function C
void ins (int matrix[SIZE][SIZE], int row, int column);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us