What is the differences between constant pointer and constant variable?

devquora
devquora

Posted On: Jan 09, 2021

 

    2 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.

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..