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
What is static and auto variables in c?
What is a ternary operator in c?
Process by which one bit pattern in to another by bit wise operation is?
What is the use of getchar() function?
What does #pragma once mean?
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
How to set file pointer to beginning c?
What are the advantages of Macro over function?
What is pointer & why it is used?
What is the basic structure of c?
Explain the difference between call by value and call by reference in c language?
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
Why c is called object oriented language?
What is memcpy() function?
How will you write a code for accessing the length of an array without assigning it to another variable?