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
Why do we need arrays in c?
What is pointer to pointer in c language?
What is #include cctype?
What is the purpose of realloc()?
In a header file whether functions are declared or defined?
State the difference between realloc and free.
how do you execute a c program in unix.
How do you sort filenames in a directory?
Differentiate between null and void pointers.
What are the ways to a null pointer can use in c programming language?
What is getch?
Describe the order of precedence with regards to operators in C.
How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?
What is the difference between malloc calloc and realloc in c?
What are linked lists in c?