• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

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 ?
0
thefirstfbli
Asked:
thefirstfbli
1 Solution
 
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
 
John KawakamiCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now