Answer Posted / vili
// this deals with negative numbers as well
int getSecondMax( int* pArray, int nSize )
{
int nMax = pArray[0];
int n2ndMax = pArray[0];
for ( int i = 1; i < nSize; i++ )
{
if ( nMax < pArray[i] )
{
n2ndMax = nMax;
n2ndMax = pArray[i];
}
}
return n2ndMax;
}
Is This Answer Correct ? | 6 Yes | 22 No |
Post New Answer View All Answers
Difference between declaration and definition of a variable.
Can constructor be static in c++?
What are the differences between the function prototype and the function defi-nition?
What is the extraction operator and what does it do?
When does the c++ compiler create temporary variables?
Explain what are mutator methods in c++?
How to access a variable of the structure?
How do you remove an element from a set in c++?
What do the header files usually contains?
Comment on c++ standard exceptions?
Which programming language is best?
What is constant in c++ with example?
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.
What are the uses of static class data?
what is a reference variable in C++?