What is the difference between constant pointer and pointer
to a constant. Give examples.
Answer Posted / vignesh1988i
Constant pointer :
it is a pointer which points to the same memory location or
to same address and and whatever value the variable which is
pointed by the pointer holds.
for eg :
char a;
char const *p;
p=&a;
here var. a is a memory location having a address and that
variable contains some character data . but this pointer
p points to the same address ( a ) however the value in
var. a changes. finally, THE POINTER POINTED TO AN ADDRESS
IS A CONSTANT ,WHATEVER THE VALUE INSIDE THE VARIABLE MAY BE..
POINTER TO A CONSTANT :
this is a pointer which points to a constant variable
assigned to that pointer. and another pointer can also be
assigned to a same const. variable to point to.
for eg :
char Const a;
char *p,*q;
p=&a;
q=&a;
thank u
Is This Answer Correct ? | 32 Yes | 0 No |
Post New Answer View All Answers
Explain the difference between exit() and _exit() function?
What is the purpose of the preprocessor directive error?
What is calloc() function?
What is main () in c?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?
Explain what happens if you free a pointer twice?
Explain how can you restore a redirected standard stream?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Is a house a mass structure?
How many levels deep can include files be nested?
Explain Function Pointer?
Is malloc memset faster than calloc?
will u please send me the placement papers to my mail???????????????????
What is c programing language?