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 |
What are the different categories of functions in c?
Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?
main() { enum _tag{ left=10, right, front=100, back}; printf("%d, %d, %d, %d", left, right, front, back); }
Can i use Two or More Main Funtion in any C program.?
Tell me what are bitwise shift operators?
What is pivot in c?
Where are local variables stored in c?
What is key word in c language?
how to implement stack work as a queue?
There are 8 billiard balls, and one of them is slightly heavier, but the only way to tell was by putting it on a weighing scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?
What is memory leak in c?
What is the difference between formatted&unformatted i/o functions?