#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

Tell me the use of bit field in c language?

0 Answers  


Why is event driven programming or procedural programming, better within specific scenario?

0 Answers   Wipro,


How to Throw some light on the splay trees?

0 Answers  


Define VARIABLE?

0 Answers   ADP,


which is conditional construct a) if statement b) switch statement c) while/for d) goto

0 Answers  






Explain is it better to bitshift a value than to multiply by 2?

0 Answers  


Why void main is used in c?

0 Answers  


Write the Program to reverse a string using pointers.

0 Answers   InterGraph,


Explain how can you restore a redirected standard stream?

0 Answers  


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

0 Answers  


a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All

3 Answers   Accenture, Digg.com,


Do you know the difference between malloc() and calloc() function?

0 Answers  


Categories