Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

#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


Please Help Members By Posting Answers For Below Questions

What are the c keywords?

1208


Can a pointer be static?

1091


What is meant by recursion?

1058


how many errors in c explain deply

2096


What does double pointer mean in c?

1192


Explain what is the purpose of "extern" keyword in a function declaration?

1076


What is the stack in c?

1163


How is = symbol different from == symbol in c programming?

1053


Why c is called a middle level language?

1117


Which of these functions is safer to use : fgets(), gets()? Why?

1115


What are qualifiers in c?

1042


What is fflush() function?

1141


List the difference between a "copy constructor" and a "assignment operator"?

1026


What is a good way to implement complex numbers in c?

1055


What is the advantage of using #define to declare a constant?

1100