What is Constant Pointers [ Const Pointer ] in C Programming :
- As name suggests , Constant Pointers Cannot be modified .
- Modification in Integer to which it Points to is Allowed
- Modification made in Pointer is Not Allowed
Syntax Declaration :
data_type * const Pointer_name ;
Live Example :
int i = 20;
int * const ptr ; // Declare Constant Pointer
ptr = &i;
*ptr = 20 ; // Valid Statement
ptr ++ ; // Invalid Statement
Explanation :
- In the Diagram Shown The at 2001 we have Store the value 15 .
- Constant Pointer is Pointer to that Variable [Pointer Stores address 2001]
- We cannot Change the Address stored in Pointer Variable i.e 2001 is fixed
- But we can Change the Value at 2001 i.e we can change value 15 to 20

0 Comments:
Post a Comment
Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email