Answer Posted / jaldeep
int sec_max(int a[])
{
if(a[0]>a[1])
{
max=a[0]
sec_max=a[1]
}
else
{
max=a[1]
sec_max=a[0]
}
for(i=1;i<n-1;i++)
{
if (a[i]>sec_max && a[i]< max)
{
sec_max=a[i];
}
else if(a[i]>max)
{
sec_max=max;
max=a[i];
}
return sec_max;
}
Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Which is most difficult programming language?
What are the two main components of c++?
When can I use a forward declaration?
What are static variables?
How many types of modularization are there in c++?
What is an adaptor class or wrapper class in c++?
What do the header files usually contains?
Is swift faster than c++?
What is a pointer with example?
Can I create my own functions in c++?
What is null pointer and void pointer?
What are c++ variables?
What is the difference between interpreters and compilers?
Tell me an example where stacks are useful?
What operator is used to access a struct through a pointer a) >> b) -> c) *