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

Explain what are the different file extensions involved when programming in c?

0 Answers  


Determine if a number is a power of 2 at O(1).

2 Answers  


#include<stdio.h> void main() { int =1; printf("%d%d%d",a++,++a,++a); }

3 Answers   VB,


What is the output for the below program? void main() { float me=1.1; double you=1.1; if(me==you) printf("love c"); else printf("know c"); }

7 Answers  


Do pointers take up memory?

0 Answers  






#include<stdio.h> int fun(); int i; int main() { while(i) { fun(); main(); } printf("hello \n"); return 0; } int fun() { printf("hi"); } answer is hello.how??wat is tat while(i) mean?

7 Answers   Intel,


2. What does static variable mean?

2 Answers  


What are the types of i/o functions?

0 Answers  


What does %c mean in c?

0 Answers  


int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give me the explanation.

15 Answers   Global Edge,


What's wrong with "char *p; *p = malloc(10);"?

5 Answers  


How can you tell whether two strings are the same?

0 Answers  


Categories