Finding Largest

main ()
{

for ( i ...  ; {
 fscanf ( .... . .ect );
arr[i]=smth;  //smth comes from txt and must use array to reach every integer
}

printf("%d", findLarge (arr));

return 0;

}

findLarge(smth) {

what should i do ? other numbers can be sorted ?

}

and what is the function header ?
LVL 1
thefirstfbliAsked:
Who is Participating?
 
John KawakamiConnect With a Mentor Commented:
Why not just scan over the array of ints, and keep track of the largest value, then return it?

function findLarge(char **arr, int count)
{
 int i, largest=0, count;
 for(i=0;i<count;i++)
    if (arr[i] > largest)
       largest=arr[i];
 return largest;
}
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0
 
_iskywalker_Commented:
you should format arr[i] to ints, then you can use qsort to sort them.
0
 
Razor2k5Commented:
try to use binary search and Functional Macros...

e.g.
#define max(a,b) (return a>=b?a:b)
0
All Courses

From novice to tech pro — start learning today.