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 will be the output for the following main() { printf("hi" "hello"); }

5 Answers   RoboSoft,


Write a program to print prime nums from 1-20 using c programing?

13 Answers   IBM,


can we execute the program with the object file

1 Answers  


Can we compile a program without main() function?

0 Answers  


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

0 Answers   IBM,






provide an example of the Group by clause, when would you use this clause

0 Answers  


which type of question asked from c / c++ in interview.

2 Answers  


Why do we use & in c?

0 Answers  


Which of the following sorts is quickest when sorting the following set: 1 2 3 5 4 1) Quick Sort 2) Bubble Sort 3) Merge Sort

7 Answers  


Explain argument and its types.

0 Answers  


which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....

2 Answers  


where can function pointers be used?

2 Answers  


Categories