Solved

Finding Largest

Posted on 2006-11-25
4
245 Views
Last Modified: 2010-04-15
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
Comment
Question by:thefirstfbli
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18010974
0
 
LVL 6

Expert Comment

by:_iskywalker_
ID: 18011900
you should format arr[i] to ints, then you can use qsort to sort them.
0
 
LVL 2

Expert Comment

by:Razor2k5
ID: 18015091
try to use binary search and Functional Macros...

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

Accepted Solution

by:
jk2001 earned 300 total points
ID: 18018268
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

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now