#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
Can we declare variables anywhere in c?
What is the use of pointers in C?
What is a header file?
Is using exit() the same as using return?
When reallocating memory if any other pointers point into the same piece of memory do you have to readjust these other pointers or do they get readjusted automatically?
Write a program with dynamically allocation of variable.
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
When is a null pointer used?
Explain what is the difference between #include and #include 'file' ?
Why dont c comments nest?
In which language linux is written?
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. Sequence of take-off is the sequence of addition to the waitlist
What are the benefits of organizational structure?
Why calloc is better than malloc?
int main() { Int n=20,i; For(i=0;i<=n;i--) { Printf(“-“); Return 0;