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
What are multiple inheritances (virtual inheritance)?
Who was the creator of c++?
Write a C++ Program to check whether a number is prime number or not?
Why c++ is faster than java?
What is istream c++?
How can a struct in c++ differs from a struct in c?
Is string an object in c++?
Can static member variables be private?
Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.
What is setf in c++?
What is operators in c++?
What is a tree in c++?
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
Can there be at least some solution to determine the number of arguments passed to a variable argument list function?
What is meant by forward referencing and when should it be used?