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...


int *p=20;
if u print like dis printf("%d",p);
o\p:- 20; how is it possible?
plz give me the explanation.

Answers were Sorted based on User's Feedback



int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give m..

Answer / lylez00

Because you're printing p, not *p. scanf takes addresses of
variables as arguments, but printf does not.

Is This Answer Correct ?    7 Yes 10 No

int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give m..

Answer / vignesh1988i

ya,, i think..
first we have declared an pointer variable *p and
assigned a value 20.... but we know that pointers are those
which can hold only the address of another variable..... so
surely in the memory P it wont have 20... so 20 will be
stored in some other unbknown variable in the memory which
wont be visible to user in thesr cases...... that unknown
memory address will be getting stored in this pointer
variable.... so when we give only p or *p it will print 20
and not the address of the unknown location containing
20........... because it will be directly accessible

Is This Answer Correct ?    7 Yes 10 No

int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give m..

Answer / immanuel

printf("%p",p); // this prints the address to 20

printf("%d",p); //this prints the value itself.

Is This Answer Correct ?    2 Yes 5 No

int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give m..

Answer / vignesh1988i

this will result in error.... pointer itself cant point to
any value... we, the users must make an explict assignment
for the pointer to point to an value .....

Is This Answer Correct ?    4 Yes 7 No

int *p=20; if u print like dis printf("%d",p); o\p:- 20; how is it possible? plz give m..

Answer / jack

It will not compile. You cant do int *p = 20;

Is This Answer Correct ?    12 Yes 18 No

Post New Answer

More C Interview Questions

What is a pointer variable in c language?

0 Answers  


What is that continue statement??

4 Answers  


program to convert a integer to string in c language'

0 Answers  


write a program of bubble sort using pointer?

3 Answers   TCS,


Why do some versions of toupper act strangely if given an upper-case letter?

0 Answers  


What is the maximum no. of arguments that can be given in a command line in C.?

0 Answers   HCL,


wap to print "hello world" without using the main function.

22 Answers   TCS, Wipro,


write a progam to display the factors of a given number and disply how many prime numbers are there?

2 Answers  


What is const keyword in c?

0 Answers  


how to find the sizof of any datatype using bit manipulations

3 Answers  


What is the difference between array and pointer?

0 Answers  


what is the difference between char * const and const char *?

2 Answers   TCS,


Categories