#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 is double pointer in c?
What is fflush() function?
Explain what is wrong with this program statement? Void = 10;
How can I implement a delay, or time a users response, with sub-second resolution?
Discuss similarities and differences of Multiprogramming OS and multiprocessing OS?
Which of the following is not an infinite loop ? a.while(1){ .... } b.for(;;){ ... } c.x=0; do{ /*x unaltered within theloop*/ ... }while(x==0); d.# define TRUE 0 ... while(TRUE){ .... }
What are the benefits of c language?
Write a Program to find whether the given number or string is palindrome.
What is assert and when would I use it?
void main() { int a=1; while(a++<=1) while(a++<=2); }
Do string constants represent numerical values?
What is array in c with example?