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

Write a program that takes a 5 digit number and calculates 2 power that number and prints it.

1 Answers  


If null and 0 are equivalent as null pointer constants, which should I use?

0 Answers  


What does c value mean?

0 Answers  


in iso what are the common technological language?

0 Answers  


int main() { int *p=new int; *p=10; del p; cout<<*p; *p= 60; cout<<*p; } what will be the output & why?

4 Answers   TCS,






Explain demand paging.

1 Answers   Agilent,


What is sizeof array?

0 Answers  


what is the difference between auto and static keywords

1 Answers   cDot, College School Exams Tests, TCS,


Write a program to print the prime numbers from 1 to 100?

7 Answers  


a program that performs some preliminary processing in C, it acts upon certain directives that will affect how the compiler does its work a) compiler b) loader c) directive d) preprocessor

0 Answers  


Write a program for finding factorial of a number.

0 Answers   Tech Mahindra,


please help me.. how to write a code of this output?? "Enter range number:"10 1 is an odd number 2 is an even numbers 3 in an odd numbers 4 " to 10" "printing all odd numbers:" 1,3,5,7,9 "printing all even numbers:" 2,4,6,8,10 "sum of all odd numbers:25 "sum of all even numbers:30 using a C Programming ARRAY pleas pleas help.. its my project ..please :(

1 Answers  


Categories