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
Differentiate between a structure and a union.
What is register variable in c language?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
What are the general description for loop statement and available loop types in c?
What is NULL pointer?
What is array of structure in c programming?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
write a program that declares an array of 30 elements named "income" in the main functions. then cal and pass the array to a programmer-defined function named "getIncome" within the "getIncome" function, ask the user for annual income of 30 employees. then calculate and print total income on the screen using the following function: "void getIncome ( ai []);
Is it fine to write void main () or main () in c?
Are pointers integers in c?
What type of function is main ()?
what do you mean by inline function in C?
What do you mean by command line argument?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
Explain what are the advantages and disadvantages of a heap?