#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

What is selection sort in c?

0 Answers  


what will be the out put. #include<stdio.h> void main() { printf("Output:"); printf(1+"vikashpatel"); }//output: ikashpatel

1 Answers   V2 Solutions,


What is memory leak in c?

0 Answers  


write a program that accepts 3 numbers from the user. dispaly the values in a descending order.

3 Answers  


What is ambagious result in C? explain with an example.

0 Answers   Infosys,


1,4,8,13,21,30,36,45,54,63,73,?,?.

10 Answers   AMB, Franklin Templeton,


Should a function contain a return statement if it does not return a value?

0 Answers  


What is the general form of function in c?

0 Answers  


Here is alphabets : abcdefgh 1) how to reverse. as hgfedcba 2) after reversal, how to group them in a pair hg fe dc ba.

2 Answers  


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

0 Answers  


What is the difference between exit() and _exit()?

2 Answers  


What is typeof in c?

0 Answers  


Categories