#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?
Answer Posted / 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 |
Post New Answer View All Answers
Why array is used in c?
What do you mean by invalid pointer arithmetic?
How pointer is different from array?
Is it better to bitshift a value than to multiply by 2?
Explain union.
What do you understand by normalization of pointers?
What is the best style for code layout in c?
Explain bit masking in c?
Explain what is meant by high-order and low-order bytes?
Do you know the purpose of 'register' keyword?
Explain the Difference between the New and Malloc keyword.
A SIMPLE PROGRAM OF GRAPHICS AND THEIR OUTPUT I WANT SEE WAHAT OUTOUT OF GRAPHICS PROGRAM
Are the variables argc and argv are local to main?
What are the different file extensions involved when programming in C?
What are the features of c languages?