What is the differences between constant pointer and constant variable?

devquora
devquora

Posted On: Jan 09, 2021

 

    3 Answers Written

  •  devquora
    Answered by Pradhyumna Palore

    Constant pointer refers to a particular variable in its lifetime while a Constant variable always contain same value in its life time.

  •  devquora
    Answered by Prathamesh Shirwadkar

    A constant variable is a variable to which value can be assigned only once. Any try to change its value through any operation or reassignment would result in an error.

    A constant pointer is a pointer pointing to fix memory location. Here the value of location can be changed but the pointer will remain to point to that memory location only. Any attempt to modify the pointer or any try to alter the location it is pointing will result in an error.

  •  devquora
    Answered by jimmy johns

    in constant pointer, we can store address of variable, but after initialisation we can not change address in that constant pointer variable..but we can change the value of variable. In constant variable, we can only store value at initialisation, after initialisation we cannot change value of variable

Related Questions

Please Login or Register to leave a response.

Related Questions

C Programming Interview Questions

What are static variables in C ?

C defines another class of variables called static variables. Static variables are of two types:Static variables tha..

C Programming Interview Questions

What is a scope resolution operator in C ?

The scope resolution operator (::) is useful in C programming when both global and local variables have the same name,..

C Programming Interview Questions

What is register variable in C language ?

C language allows the use of the prefix register in primitive variable declarations. Such variables are called register..