Thursday, 2 July 2015

C Language Problem Solution

Pass 2d Array to function


#include<stdio.h>
#include<conio.h>
void show(int *ar[][3],int a)
{
int r,c;
for(r=0;r<a;r++)
{
for(c=0;c<3;c++)
{
printf("Enter a number>> ");
scanf("%d",&ar[r][c]);
}
}
clrscr();
for(r=0;r<a;r++)
{
for(c=0;c<3;c++)
{
printf("\t%d",ar[r][c]);
}
printf("\n");
}




}
void main()
{
int ar[5][5];
clrscr();
show(ar,3);
getch();
}