#include <stdio.h>
#define sqr(x) (x*x)
int main()
{
int x=2;
printf("value of x=%d",sqr(x+1));
}
What is the value of x?
Answers were Sorted based on User's Feedback
Answer / jugal
The OUTPUT of the program wud be
"value of x=9"
NOTE:
#define sqr(x) (x*x) and
#define sqr(x) x*x
are two very different things
what Divakar and all are saying is referring to the 2nd
one, where as in this case the 1st one is given
Coming to the actual question
The value of x will remain 2, since its value is not being
changed anywhere in the program, its just being passed to a
macro, but NOT modified there either.
Try adding a line at the end of the program
printf("x=%d",x);
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / poorna
Warning: Function Should have return value........
| Is This Answer Correct ? | 4 Yes | 5 No |
What does c mean?
What is the argument of a function in c?
Convert the following expression to postfix and prefix X $ Y Z - M + N + P / Q / (R + S)
What is the use of structure padding in c?
can we print any string without using terminator?
what is level of tree if leaf node is at level 4.please explain.
Are negative numbers true in c?
find a number whether it is even or odd without using any control structures and relational operators?
22 Answers Microsoft, Shashank Private Limited,
What are the different types of pointers used in c language?
Explain what is output redirection?
How can I find out how much free space is available on disk?
What is a null pointer in c?