Wednesday 20 February 2013

passing array to function



#include<stdio.h>
#include<conio.h>
const int row=3,col=4;
int high(int temp[3][4])
{
int i,j,h=0;
for( i=0;i<row;i++)
{
for( j=0;j<col;j++)
{
if(h<temp[i][j])
h=temp[i][j];
}
}
return h;
}

void main()
{
int temp[][4]={12,23,45,10,13,24,24,56,30,45,28,90};
printf("%d",high(temp));
getch();
}

No comments:

Post a Comment