how to find out the biggest element (or any other
operation) in an array which is dynamic. User need not to
mention the array size while executing.

Answers were Sorted based on User's Feedback



how to find out the biggest element (or any other operation) in an array which is dynamic. User ne..

Answer / sudarsan

#include<stdio.h>
#include<conio.h>
void main()
{
int n,BIG;
printf("enter the numbers :");
scanf("%d",&n);
BIG=n;
do
{
fflush(stdin);
scanf("%d",&n);
if(n>=BIG)
BIG=n;
}while(((char)n>=65)&&((char)<=122));
printf("the biggest number is : %d",BIG);
getch();
}


it is a good one..
But if the user not give the array size,by using sizeof()
operator we can find the array size then by dividing the
total size with the size of data type ,we can find the
number of elements in the array then after we can find the
largest number of the array .

Is This Answer Correct ?    0 Yes 1 No

how to find out the biggest element (or any other operation) in an array which is dynamic. User ne..

Answer / rahul

soory i dont no but i need this Answer

Is This Answer Correct ?    0 Yes 3 No

how to find out the biggest element (or any other operation) in an array which is dynamic. User ne..

Answer / vignesh1988i

it is said that while executing also the user should not specify the size means it can be done in another method without using ARRAYS......... using only one variable.. since it is asked to find only the biggest element , this program suits.....

#include<stdio.h>
#include<conio.h>
void main()
{
int n,BIG;
printf("enter the numbers :");
scanf("%d",&n);
BIG=n;
do
{
fflush(stdin);
scanf("%d",&n);
if(n>=BIG)
BIG=n;
}while(((char)n>=65)&&((char)<=122));
printf("the biggest number is : %d",BIG);
getch();
}


thank u

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

in case any function return float value we must declare a) the function must be declared as 'float' in main() as well b) the function automatically returned float values c) function before declared 'float' keyword d) all the above

0 Answers  


What is the difference function call by value & function call by reference?

6 Answers  


what is data structure.in linear and non linear data structures which one is better?Explain

3 Answers   Wipro,


How can I sort a linked list?

0 Answers  


If the size of int data type is two bytes, what is the range of signed int data type?

0 Answers  






application attempts to perform an operation?

0 Answers  


Can the curly brackets { } be used to enclose a single line of code?

0 Answers  


Explain this code. #include <stdio.h> void f1(int *k) { *k = *k + 10; } main ( ){ int i; i = 0; printf (" The value of i before call %d \n", i); f1 (&i); printf (" The value of i after call %d \n", i); }

3 Answers   IBM,


Explain how are 16- and 32-bit numbers stored?

0 Answers  


how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?

0 Answers  


What's the difference between constant char *p and char * constant p?

0 Answers   Celstream,


extern static int i func() { i =10; i++; printf("%d \n",i); } main() { i =20; printf("%d \n",i); func(); printf("%d \n",i); }

2 Answers  


Categories