Saturday, December 20, 2025

Explain with example "const int *const ptr" and its use

 This is for readonly purpose

const int *const ptr _> read as constant pointer to integer constant.

const int -> variable value must not be modified

*const ptr -> ptr should point to the same address.

This prevents

1) Accidental modification of the value

2) Accidental modification of the address.