#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
What are c identifiers?
List the difference between a 'copy constructor' and a 'assignment operator' in C?
Explain the ternary tree?
Write the test cases for checking a variable having value in range -10.0 to +10.0?
What do you mean by dynamic memory allocation in c? What functions are used?
Differentiate between null and void pointers.
What is the difference between char array and char pointer?
What is identifiers in c with examples?
What do you know about the use of bit field?
program for reversing a selected line word by word when multiple lines are given without using strrev
Explain union. What are its advantages?
What is the explanation for the dangling pointer in c?
How many levels of indirection in pointers can you have in a single declaration?
What is a program flowchart?
Write a program to print ASCII code for a given digit.