#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 |
24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?
do u print this format '(((())))'. This brackets is based on user input like 4 or 5 or 6,without using any loop's?
what is the use of bitfields & where do we use them?
plz answer..... a program that reads non-negative integer and computes and prints its factorial
What is #error and use of it?
How can I read/write structures from/to data files?
What is the difference between void main() and void main (void) give example programme?
what is c
What is external and internal variables What is dynamic memory allocation what is storage classes in C
What is ## preprocessor operator in c?
what is the coding of display the factorial of a number using array and function?
what is the role you expect in software industry?