Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Program in C that seeks and memorize two maximums in an array

Status
Not open for further replies.

Mejdi_tn

Junior Member level 3
Joined
Oct 20, 2007
Messages
28
Helped
7
Reputation
14
Reaction score
6
Trophy points
1,283
Activity points
1,473
hi
i need programm that seeks two maximum in a array and memorise there position
thing you
 

kiprono

Advanced Member level 4
Joined
Nov 18, 2005
Messages
114
Helped
19
Reputation
38
Reaction score
4
Trophy points
1,298
Location
Nairobi
Activity points
1,842
Re: help C

Search for binary search programs on Google.
 

jhbbunch

Full Member level 4
Joined
Feb 21, 2006
Messages
199
Helped
17
Reputation
34
Reaction score
3
Trophy points
1,298
Activity points
2,902
Re: help C

Is this what you mean?:

for (i = 0; i > arraylength; i++)
{
if (array > max1_index)
{
temp = max1_index;
max1_index= i;
max2_index = temp;
}
else if (array > max2_index)
max2_index = i;
}
 

kiprono

Advanced Member level 4
Joined
Nov 18, 2005
Messages
114
Helped
19
Reputation
38
Reaction score
4
Trophy points
1,298
Location
Nairobi
Activity points
1,842
Re: help C

Thats cool for a start!
 

mmelek1

Member level 4
Joined
Apr 20, 2002
Messages
71
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Activity points
236
Re: help C

jhbbunch said:
Is this what you mean?:

for (i = 0; i > arraylength; i++)
{
if (array > max1_index)
{
temp = max1_index;
max1_index= i;
max2_index = temp;
}
else if (array > max2_index)
max2_index = i;
}


First, you need to set max1_index, otherwise you can't say if (array > max1_index)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top