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 c identifiers?

1148


List the difference between a 'copy constructor' and a 'assignment operator' in C?

1137


Explain the ternary tree?

1074


Write the test cases for checking a variable having value in range -10.0 to +10.0?

2366


What do you mean by dynamic memory allocation in c? What functions are used?

1221


Differentiate between null and void pointers.

1226


What is the difference between char array and char pointer?

1116


What is identifiers in c with examples?

1240


What do you know about the use of bit field?

1096


program for reversing a selected line word by word when multiple lines are given without using strrev

2532


Explain union. What are its advantages?

1125


What is the explanation for the dangling pointer in c?

1174


How many levels of indirection in pointers can you have in a single declaration?

1141


What is a program flowchart?

1277


Write a program to print ASCII code for a given digit.

1125