#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 |
Why does not c have an exponentiation operator?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
What is a good way to implement complex numbers in c?
Write a code of a general series where the next element is the sum of last k terms.
Do you have any idea about the use of "auto" keyword?
What is call by reference in functions?
How can I write a function analogous to scanf?
How is actual parameter different from the formal parameter?
Explain which of the following operators is incorrect and why? ( >=, <=, <>, ==)
HOW TO HANDLE EXCEPTIONS IN C
what is the purpose of the code, and is there any problem with it. bool f( uint n ) { return (n & (n-1)) == 0; }
what is the difference between <stdio.h> and "stdio.h"
14 Answers Invendis, Kanbay, Mastek, MathWorks,