wats the diference btwen constant pointer and pointer to a
constant.pls give examples.

Answer Posted / rudra prasad panda

Pointer is a variable containing the addres of another
variable;
Constant pointer is a variable which points to a variable
constantly.it means that , once it is initialised,it cannot
be changed.Till the end of program,it points to that
variable only;
EXAMPLE:
char k,m;
const char *p=&k;
p=&m;//(syntax error)

********
A pointer to a constant is a pointer such that the contents
of the variable(pointed by the pointer)cannot be modified
throuhg the pointer;
EXAMPLE:
char m='l';
char * const p;
p=&m;
*p='u';//syntax error
m='k';//no syntax error

Is This Answer Correct ?    8 Yes 42 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1510


How reliable are floating-point comparisons?

632


What is 2 d array in c?

564


How many types of errors are there in c language? Explain

577


What is a function in c?

579






Explain c preprocessor?

689


What happens if a header file is included twice?

604


Why c is called a mid level programming language?

610


Are pointers really faster than arrays?

573


A c program to display count values from 0 to 100 and flash each digit for a secong.reset the counter after it reaches 100.use for loop,. pls guys hepl me.. :(

1748


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2007


Why is not a pointer null after calling free? How unsafe is it to use (assign, compare) a pointer value after it is been freed?

605


Is null a keyword in c?

741


What is the -> in c?

591


Can you apply link and association interchangeably?

682