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);
}
Answer Posted / 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 |
Post New Answer View All Answers
I have a varargs function which accepts a float parameter?
Explain what are multibyte characters?
How do I use void main?
What does sizeof int return?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
What are the various types of control structures in programming?
What does static variable mean in c?
Write a program to print numbers from 1 to 100 without using loop in c?
Describe the order of precedence with regards to operators in C.
What is the value of uninitialized variable in c?
What are the difference between a free-standing and a hosted environment?
What is quick sort in c?
Wt are the Buses in C Language
How would you obtain the current time and difference between two times?
What are local static variables? How can you use them?