NIELIT O Level January 2016
Q 6.c : Write a function to read a two dimensional matrix along with the number of rows and columns in it, from the user. The contents of the array and the number of rows and columns should be passed back to the calling function.
Solution :
/* ************************************************
Girfa : Student Help
Passing Two dimentional array to a
function
for more program visit :
http://girfahelp.blogspot.com/p/c-language-assignment.html
*************************************************/
#include<stdio.h>
#include<conio.h>
#define
ROW 10
#define
COL 10
void
print(int (*)[],int,int);
void
main()
{
int ar[ROW][COL],r,c,i;
clrscr();
for(r=0,i=1;r<ROW;r++)
{
for(c=0;c<COL;c++)
{
ar[r][c]=i;
i++;
}
}
printf("Enter Number of row and
column to read>> ");
scanf("%d%d",&r,&c);
print(ar,r,c);