What will be printed as the result of the operation below:
#include<..>
int x;
int modifyvalue()
{
return(x+=10);
}
int changevalue(int x)
{
return(x+=1);
}
void main()
{
int x=10;
x++;
changevalue(x);
x++;
modifyvalue();
printf("First output:%d\n",x);
x++;
changevalue(x);
printf("Second output:%d\n",x);
modifyvalue();
printf("Third output:%d\n",x);
}
Answers were Sorted based on User's Feedback
Answer / civa
The Output will be:
First output : 12
Second output : 13
Third output : 13
Is This Answer Correct ? | 24 Yes | 3 No |
Answer / selloorhari
The Output will be:
First output : 12
Second output : 13
Third output : 14
for changevalue() function:
Even though the value of x(11) is sent to
changevalue() and it returns x(12), no variable is assigned
to capture that 12. So, in main() function, x remains as 11(
not as 12 ) . then it gets incremented and prints the value
12...
And, the Same story for other functions also.....
Is This Answer Correct ? | 2 Yes | 16 No |
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
What is the difference between procedural and declarative language?
Why the below program throughs error during compilation? #include<stdio.h> #include<conio.h> enum { ZERO, ONE, TWO, }; main() { printf("%d",&TWO); getch(); }
Can you write the algorithm for Queue?
0 Answers College School Exams Tests, TCS,
Can anyone tell what is stack overflow? what precaution we should take?
# define prod(a,b)=a*b main() { int x=2; int y=3; printf("%d",prod(x+2,y-10)); } the output of the program is a.8 b.6 c.7 d.none
List the difference between a While & Do While loops?
What is the difference between fread buffer() and fwrite buffer()?
What is true about the following C Functions (a) Need not return any value (b) Should always return an integer (c) Should always return a float (d) Should always return more than one value
how to find out the union of two character arrays?
write a program for fibonaci series by using while loop in c?
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon