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

Answer Posted / rani

Constant pointer cannot be reassigned to different objects
once its initialized. It can be used to modify the object
that it points to.

Eg.
int *const constPtr;

*constPtr =0; //can be modified like this

Pointer to constant can be reassigned to point to another
object of same type.

int const *ptrConst;

ptrConst = 0;

Is This Answer Correct ?    37 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the role you expect in software industry?

1651


Explain what is the advantage of a random access file?

659


What is the difference between ++a and a++?

688


What happens if a header file is included twice?

588


Differentiate between functions getch() and getche().

618






How to set file pointer to beginning c?

662


Write a code on reverse string and its complexity.

606


while initialization of array why we use a[][2] why not a[2][]...?

1861


Tell us something about keyword 'auto'.

659


in linking some of os executables are linking name some of them

1647


What are header files? What are their uses?

634


What is the difference between the expression “++a” and “a++”?

648


Find MAXIMUM of three distinct integers using a single C statement

622


How will you divide two numbers in a MACRO?

708


What are structural members?

566