Tag:Const qualifier

  • Detailed explanation of const qualifier summary in C / C + +


    Const qualifier Const is a qualifier. The value of a variable defined by const cannot be changed. Const initialization Since const cannot be changed once it is created, we must initialize it const int a;// Error, const variable must be initialized! const int b=10;// Correct, compile time initialization const int c=get_ size();// Correct, runtime initialization […]

  • Const qualifier in C + + primer


    Const qualifier Const is a type modifier used to describe objects that never change. Once defined, const objects cannot be assigned new values, so they must be initialized. For example:const int bufsize = 512; Its value cannot be changed once it is defined, and it is only valid within the file by default. If you […]