#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
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 |
Answer / deepa
ther wud be no amswer as the for loop is executed infinitly
| Is This Answer Correct ? | 3 Yes | 1 No |
What language is lisp written in?
What is assert and when would I use it?
What are the differences between new and malloc in C?
How can I invoke another program (a standalone executable, or an operating system command) from within a c program?
write a program that prints a pascal triangle based on the user input(like how many stages) in an efficient time and optimized code?
what is the difference between definition and declaration? give me some examples.
How can a program be made to print the line number where an error occurs?
difference between my-strcpy and strcpy ?
3 Answers Geometric Software, IIM, Infosys,
what is the difference between normal variables and pointer variables..............
15 Answers HP, Infosys, Satyam, Vivekanand Education Society,
What is typedf?
What is linear search?
Can we change the value of static variable in c?