Question 2 : What is the difference between constant to pointer and pointer to constant?



What is the difference between constant to pointer and pointer to constant?


NoPointer to ConstantConstant Pointers
1*ptr = 20 Statement is Invalid in Pointer to Constant i.e Assigning Value is Illegal*ptr = 20 is Absolutely Valid in Constant Pointers i.e Assigning Value is Perfectly legal
2ptr ++ Statement is Valid in Pointer to Constantptr ++ Statement is Valid in Constant Pointers
3Pointer Can be Incremented and DecrementedPointer Cannot be Incremented and Decremented
4Pointer is Pointing to Constant Data ObjectConstant Pointer is Pointing to Data Objects
5Declaration : const int *ptr ;Declaration : int * const ptr ;