#include<stdio.h>
int SumElement(int *,int);
void main(void)
{
int x[10];
int i=10;
for(;i;)
{
i--;
*(x+i)=i;

}
printf("%d",SumElement(x,10));
}
int SumElement(int array[],int size)
{
int i=0;
float sum=0;
for(;i<size;i++)
sum+=array[i];
return sum;
}

output?

Answers were Sorted based on User's Feedback



#include<stdio.h> int SumElement(int *,int); void main(void) { int x[10]; ..

Answer / madhu

Ans is 45.
for(exp1;exp2;exp3)
So the 2nd expression when once it becomes 0 control comes
out of for loop and executes the funtion which gives the
answer as 45
0+1+2+3+4+5+6+7+8+9

Is This Answer Correct ?    7 Yes 0 No

#include<stdio.h> int SumElement(int *,int); void main(void) { int x[10]; ..

Answer / deepa

ther wud be no amswer as the for loop is executed infinitly

Is This Answer Correct ?    3 Yes 1 No

#include<stdio.h> int SumElement(int *,int); void main(void) { int x[10]; ..

Answer / mannucse

55

Is This Answer Correct ?    3 Yes 2 No

#include<stdio.h> int SumElement(int *,int); void main(void) { int x[10]; ..

Answer / jai

45

Is This Answer Correct ?    1 Yes 1 No

#include<stdio.h> int SumElement(int *,int); void main(void) { int x[10]; ..

Answer / lusi dash

55

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?

2 Answers  


do u print this format '(((())))'. This brackets is based on user input like 4 or 5 or 6,without using any loop's?

1 Answers   Oracle,


what is the use of bitfields & where do we use them?

2 Answers  


plz answer..... a program that reads non-negative integer and computes and prints its factorial

2 Answers  


What is #error and use of it?

0 Answers  






How can I read/write structures from/to data files?

0 Answers  


What is the difference between void main() and void main (void) give example programme?

0 Answers  


what is c

1 Answers  


What is external and internal variables What is dynamic memory allocation what is storage classes in C

3 Answers  


What is ## preprocessor operator in c?

0 Answers  


what is the coding of display the factorial of a number using array and function?

1 Answers  


what is the role you expect in software industry?

0 Answers   HCL,


Categories