2021年5月1日星期六

why can I still give const value a new value

enter image description hereThe book said I cannot change the value of const once I gave it a number, but it seems I can still give it a number even if it was given.

#include<iostream>  using namespace std;  const int fansc(100);  cout<< fansc << endl; //output:100  int fansc(20);  cout<< fansc << endl;//output:20  
https://stackoverflow.com/questions/67352317/why-can-i-still-give-const-value-a-new-value May 02, 2021 at 09:44AM

没有评论:

发表评论