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 is the difference between an enumeration and a set of pre-processor # defines?

822


Differentiate between a pointer and a reference with respect to c++.

692


What are the two types of comments?

566


Which programming language should I learn first?

570


What is the best c++ compiler for windows 10?

574






What is prototype for that c string function?

682


Is c++ proprietary?

570


Is c++ still in demand?

626


What do you mean by inheritance in c++? Explain its types.

604


Do class method definitions?

581


What is lambda in c++?

568


What is the real purpose of class – to export data?

607


Does c++ have finally?

561


What do c++ programmers do?

547


What is meant by forward referencing and when should it be used?

544