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

who developed c and why he developed c?

5 Answers  


main() { int i,n=010; int sum=0; for(i=1;i<=n;i++) {s=s+i; } printf("%d",&s); getch(); }

6 Answers  


Toggle nth bit in a given integer - num

5 Answers   Qualcomm,


write a c program to find reminder and quotient if one number is divided by other.to code this program don't use more than 2 variables

2 Answers   TCS,


What is the difference between struct and union in C?

1 Answers  






What are static variables in c?

0 Answers  


How the C program can be compiled?

11 Answers   HP,


Write a program to identify if a given binary tree is balanced or not.

0 Answers   JPMorgan Chase,


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

0 Answers  


Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result

0 Answers  


What is the symbol indicated the c-preprocessor?

0 Answers  


a=(1,2,3); b=1,2,3; c=1,(2,3); d=(1,2),3; what's the value of 'a','b','c','d'

2 Answers  


Categories