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 is c++ vb?
Explain the term memory alignment?
Explain stack unwinding.
Is there finally in c++?
Differentiate between a pointer and a reference with respect to c++.
Is vector a class in c++?
Why c++ is better than c language?
What is the use of map in c++?
How can you quickly find the number of elements stored in a static array?
What is binary search in c++?
Why do we need function?
How are the features of c++ different from c?
What are the four partitions in which c++ compiler divides the ram?
What is ios class in c++?
What are the vectors in c++?