#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

How old is c programming language?

0 Answers  


what is c?

13 Answers   Tech Mahindra,


int x=5; printf("%d%d%d",x,x<<2,x>>2);

2 Answers   TANCET,


Explain what is a const pointer?

0 Answers  


Write a program that accept anumber in words

0 Answers  


what is an inline fuction??

2 Answers  


For what purpose null pointer used?

0 Answers  


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

0 Answers   HCL,


What is d scanf?

0 Answers  


What is equivalent to ++i+++j?

0 Answers  


Please send me WIPRO technical question to my mail ID.. its nisha_g28@yahoo.com please its urgent

0 Answers  


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

0 Answers   Wilco,


Categories