#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 pointers? What are different types of pointers?
What is static function in c?
Define C in your own Language.
What does malloc () calloc () realloc () free () do?
Explain how does flowchart help in writing a program?
Is array name a pointer?
What are the c keywords?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above
How can I read in an object file and jump to locations in it?
What are the advantage of c language?
How can I access an I o board directly?
How can I manipulate individual bits?
Whats s or c mean?
How can I make sure that my program is the only one accessing a file?
Explain how do I determine whether a character is numeric, alphabetic, and so on?