Answer Posted / vinod, bangalore, india
int Second_Max(int* numbers, int Lenght)
{
int Max, Sec_Max, index;
Max = Sec_Max = numbers[0];
for(index=0; (index<Lenght) &&(Max == Sec_Max);
index++)
{
if(Max > numbers[index])
Sec_Max = numbers[index];
else
Max = numbers[index];
}
if(index == Lenght)
{
printf("Array contain simillar data and the
data is = %d \n", Max);
return false;
}
for(index =0; index < Lenght; index++)
{
if(numbers[index] > Max)
{
Sec_Max = Max;
Max = numbers[index];
}
if((numbers[index] < Max) && (numbers
[index] > Sec_Max))
{
Sec_Max = numbers[index];
}
}
return Sec_Max;
}
| Is This Answer Correct ? | 2 Yes | 7 No |
Post New Answer View All Answers
Can a new be used in place of old mallocq? If yes, why?
What is string in c++ programming?
What is meant by a delegate?
Explain the purpose of the keyword volatile.
Can static member variables be private?
Of the numbers 12 23 9 28 which would be at the top of a properly implemented maxheap a) 28 b) 9 c) Any of them could be
What are the advantages of c++? Explain
Is c++ pass by reference or value?
How does a copy constructor differs from an overloaded assignment operator?
What is anonymous object in c++?
What is the difference between a declaration and a definition?
Which programming language is best to learn first?
What is the precedence when there is a global variable and a local variable in the program with the same name?
Is there structure in c++?
What is a static member?