find second largest element in array w/o using sorting
techniques? use onle one for loop.
Answer Posted / guest
max = 2ndmax= array[0];
for (i=0;i,length;i++)
{
if (array[i]>max)
{
2ndmax=max;
max=array[i];
}
}
return 2nd max
| Is This Answer Correct ? | 40 Yes | 74 No |
Post New Answer View All Answers
Is c pass by value or reference?
Can we change the value of static variable in c?
What is bss in c?
What is the use of a static variable in c?
What is the purpose of 'register' keyword in c language?
Where in memory are my variables stored?
What is a pointer on a pointer in c programming language?
Write a program to check palindrome number in c programming?
What is the purpose of type declarations?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Using which language Test cases are added in .ptu file of RTRT unit testing???
what is different between auto and local static? why should we use local static?
What is null pointer constant?
number of times a digit is present in a number
Can math operations be performed on a void pointer?