Find the second maximum in an array?

Answer Posted / adnan sheikh

int SecondMax(int Array[], int ALength)
{
int Fmax,Smax;
Fmax=Smax=Araay[0];
for (int i = 0; i < ALength; i++)
{
if (Array[i] > Smax){
if (Array[i] < Fmax){
Smax = Array[i];
}
else{
Smax = Fmax;
Fmax = Array[i];
}
}
}
return Smax;
}

Is This Answer Correct ?    9 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What methods can be overridden in java?

679


In a function declaration what does extern means?

604


What is the most useful programming language?

608


what Is DCS ? what i will get benefit when i did?

1838


What do you mean by public protected and private in c++?

605






What is std :: flush?

581


What are libraries in c++?

611


What does h mean in maths?

576


why and when we can declar member fuction as a private in the class?

1602


What does namespace mean in c++?

557


What is the full form of stl in c++?

683


What are the benefits of operator overloading?

683


Explain the scope of resolution operator.

633


What is an orthogonal base class in c++?

662


Which operations are permitted on pointers?

570