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 is a pointer and how it is initialized?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)
can please someone teach me how to create this program using while statement.. this is the output should look like 0 2 4 6 8 10 -thanks.. :) need it asap...
print ur name without using any semicolon in c/c++....
21 Answers Bosch, TCS, Wipro,
What is a macro, and explain how do you use it?
what is the purpose of the code, and is there any problem with it. unsigned int v[10]; unsigned int i = 0; while (i < 10) v[i] = i++;
I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.
What are directives in c?
Write a program to generate the first n terms in the series --- 2,3,5,7,11,...,17
What are pragmas and what are they good for?
main() { int a[3][4] ={1,2,3,4,5,6,7,8,9,10,11,12} ; int i, j , k=99 ; for(i=0;i<3;i++) for(j=0;j<4;j++) if(a[i][j] < k) k = a[i][j]; printf("%d", k); }
4 Answers Vector, Wipro, Zoho,
Why enum is used in c?