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
Can a function argument have default value?
What are the types of data structures in c?
Why c is a procedural language?
how to create duplicate link list using C???
Explain how can a program be made to print the line number where an error occurs?
How can you determine the size of an allocated portion of memory?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is the size of enum in c?
What are the disadvantages of external storage class?
Why enum is used in c?
What is the difference between Printf(..) and sprint(...) ?
In c language can we compile a program without main() function?
Who is the founder of c language?
What are header files? What are their uses?
How can this be legal c?