hi,
i want to print Largest number from any 5 rows.Th number printed should be any one of the largest in the five rows of 2d arrays.I have created code for largest number in each row but how to pick and print them randomly?.
Code:
#include<conio.h>
main( )
{
int a,b,c,d,e,x;
int arr[] = {a,b,c,d,e};
int Matrix[5][5] ={ /*Initializing array*/
2,4,3,5,9,
6,8,2,2,10,
9,12,345,23,5,
45,67,349,234,56,
23,34,64,347,6
};
printf ( "Largest number from any 5 rows is : ") ;
a= ROW(&Matrix[0][0]);
b= ROW(&Matrix[1][0]);
c= ROW(&Matrix[2][0]);
d= ROW(&Matrix[3][0]);
e= ROW(&Matrix[4][0]);
x = ;/*<===here i want any value of the array arr[]*/
printf("\n%d",x);
}
ROW(int *a)
{
int i,j,temp;
temp = *a;
for(j=1;j<=4;j++)
{
if (temp<*(a+j))
temp = *(a+j);
}
return(temp);
}