Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Finding Largest

Posted on 2006-11-25
4
Medium Priority
?
251 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 143

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:
John Kawakami earned 1200 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

636 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