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
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 |
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 |
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 |
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 |
what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }
write a program to display the numbers in the following 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4
What are dangling pointers in c?
Why main is used in c?
who invented c
What is a static function in c?
which types of data structure will i use to convert infix to post fix???
What is dynamic memory allocation?
what is pointer?
13 Answers HCL, TCS,
What is the output for the below program? void main() { float me=1.1; double you=1.1; if(me==you) printf("love c"); else printf("know c"); }
State two uses of pointers in C?
please explain every phase in the "SDLC" in the dotnet.