1.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision
Answer Posted / sachin
1.#include<stdio.h>
int main()
{
int a[10]={222,111,4,5,6,8,1,77,0,4};
int i=0,max=0,sec_max=0;
for(i=0;i<10;i++)
{
if(a[i]>max)
{
sec_max=max;
max=a[i];
}
else if(a[i]>sec_max)
{
sec_max=a[i];
}
}
printf("Max= %d Second Max=%d",max,sec_max);
}
Is This Answer Correct ? | 23 Yes | 2 No |
Post New Answer View All Answers
A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream
What are the scope of static variables?
Can you please explain the scope of static variables?
Explain the difference between strcpy() and memcpy() function?
Explain what’s a signal? Explain what do I use signals for?
Find MAXIMUM of three distinct integers using a single C statement
Explain enumerated types in c language?
Differentiate abs() function from fabs() function.
Which is better between malloc and calloc?
What is an lvalue?
What is the equivalent code of the following statement in WHILE LOOP format?
How can I determine whether a machines byte order is big-endian or little-endian?
What are called c variables?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
Explain bitwise shift operators?