Wednesday, 23 January 2019

What are storage qualifiers in C++

What are storage qualifiers in C++ ?

Answer:

They are..

const

volatile

mutable

Const keyword indicates that memory once initialized, should not be altered by a program.
Volatile keyword indicates that the value in the memory location can be altered even though nothing in the program code modifies the contents. for example if you have a pointer to hardware location that contains the time, where hardware changes the value of this pointer variable and not the program. The intent of this keyword to improve the optimization ability of the compiler.

Mutable keyword indicates that particular member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant.
struct data { char name[80];

No comments:

Post a Comment