is const (c++) optional?

前端 未结 11 634
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-11 21:06

according to some tutorials i read a while back, the \"const\" declaration makes a variable \"constant\" ie it cannot change later.
But i find this con

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-11 21:19

    People usually face this problem when they start using the const keyword. Believe me, it really helps. Leave it to the compiler to take care of the cosntness of the variable, instead of you taking care to not alter its value anywhere.

提交回复
热议问题