Tag:Const qualifier

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

    Time:2021-11-29

    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

    Time:2020-10-29

    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 […]