#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

When would you use a pointer to a function?

0 Answers  


Differentiate call by value and call by reference?

0 Answers   Cyient,


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

0 Answers  


#include<stdio.h> void main() { char *str; long unsigned int add; str="Hello C"; add=&str[0]; printf("%c",add); } What is the output?

4 Answers   Infosys,


What is conio h in c?

0 Answers  






what is mean by Garbage collection ? Please answer me. Advance thanks.

4 Answers   Excel,


Explain in detail how strset (string handling function works )pls explain it with an example.

1 Answers  


Describe how arrays can be passed to a user defined function

0 Answers  


What is the difference between mpi and openmp?

0 Answers  


What are called c variables?

0 Answers  


WHAT IS THE DEFINATION OF IN TECHNOLOGY AND OFF TECHNOLOGY ?

1 Answers   IBM,


what is the different bitween abap and abap-hr?

0 Answers   TCS,


Categories