write a method for an array in which it can display the
largest n next largest value.



write a method for an array in which it can display the largest n next largest value...

Answer / akshatgarg

well there are many methods one simple method i
Find the largest.
Find the smallest.
replace largest by smallest-1
then again search for the largest.

Now this time u will get the second largest number.

Is This Answer Correct ?    3 Yes 4 No

Post New Answer

More C Interview Questions

How many parameters should a function have?

0 Answers  


Why shouldn’t I start variable names with underscores?

0 Answers  


What is alloca() and why is its use discouraged?

1 Answers  


What language is lisp written in?

0 Answers  


Write a program using bitwise operators to invert even bits of a given number.

2 Answers  






what is the difference between getch() and getchar()?

10 Answers   Huawei, Infosys,


What is indirection in c?

0 Answers  


consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value

4 Answers   TCS,


Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen)

1 Answers   NetApp, PTU, Wipro,


Differentiate fundamental data types and derived data types in C.

0 Answers   HCL,


we called a function and passed something do it we have always passed the "values" of variables to the called function. such functions calles are called a) calls by reference b) calls by value c) calls by zero d) none of the above

0 Answers  


What do you mean by scope of a variable in c?

0 Answers  


Categories