#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?
Answer Posted / 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 |
Post New Answer View All Answers
How variables are declared in c?
Describe static function with its usage?
Can you apply link and association interchangeably?
Explain pointer. What are function pointers in C?
Explain the use of fflush() function?
What does it mean when the linker says that _end is undefined?
What are predefined functions in c?
I need previous papers of CSC.......plz help out by posting them.......
What are the advantages of using linked list for tree construction?
How can I swap two values without using a temporary?
When should a type cast be used?
What are 3 types of structures?
Write a program to print “hello world” without using semicolon?
find the sum of two matrices and WAP for it.
Difference between pass by reference and pass by value?