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
In C programming, how do you insert quote characters (‘ and “) into the output screen?
how to solve "unable to open stdio.h and conio.h header files in windows 7 by using Dos-box software
In a header file whether functions are declared or defined?
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
Explain the use of bit fieild.
What are the Advantages of using macro
What are the different types of control structures?
What is a good way to implement complex numbers in c?
What are header files in c?
pgm to find number of words starting with capital letters in a file(additional memory usage not allowed)(if a word starting with capital also next letter in word is capital cann't be counted twice)
Is it possible to use curly brackets ({}) to enclose single line code in c program?
c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above
how to count no of words,characters,lines in a paragraph.
What does stand for?
What is a shell structure examples?