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


Please Help Members By Posting Answers For Below Questions

Explain the difference between exit() and _exit() function?

625


What is the purpose of the preprocessor directive error?

672


What is calloc() function?

614


What is main () in c?

580


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

646






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.?

612


Explain what happens if you free a pointer twice?

602


Explain how can you restore a redirected standard stream?

583


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.....

1364


Is a house a mass structure?

635


How many levels deep can include files be nested?

642


Explain Function Pointer?

676


Is malloc memset faster than calloc?

605


will u please send me the placement papers to my mail???????????????????

1355


What is c programing language?

608