1.find the second maximum in an array?
2.how do you create hash table in c?
3.what is hash collision

Answer Posted / rao

#include<stdio.h>

int main()
{
int arr[] = {2,3,20,7,8,1};
int max, sec;
int i;
max=0;
sec=0;
for ( i=0; i< 6; i++)
{
if(arr[i] > max)
max = arr[i];
}

for ( i=0; i< 6; i++)
{
if ( (arr[i] > sec) && (arr[i] < max))
sec = arr[i];
}
printf(" max=%d\n sec=%d\n", max, sec);
}

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is static and auto variables in c?

563


What is a ternary operator in c?

646


Process by which one bit pattern in to another by bit wise operation is?

613


What is the use of getchar() function?

624


What does #pragma once mean?

682






cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration

630


How to set file pointer to beginning c?

662


What are the advantages of Macro over function?

1189


What is pointer & why it is used?

600


What is the basic structure of c?

551


Explain the difference between call by value and call by reference in c language?

643


the process of defining something in terms of itself is called (or) in C it is possible for the functions to call themselves. A function called a) nested function b) void function c) recursive function d) indifinite function

754


Why c is called object oriented language?

577


What is memcpy() function?

618


How will you write a code for accessing the length of an array without assigning it to another variable?

611