Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于练习2.32 #79

Open
CirillaZhu opened this issue Mar 26, 2021 · 1 comment
Open

关于练习2.32 #79

CirillaZhu opened this issue Mar 26, 2021 · 1 comment

Comments

@CirillaZhu
Copy link

此节在于讲解 constexpr和常量表达式,对应练习最好用到。

对此节,更合适的解法是改为:
const int null = 0, * p = null; // p 是 low-level const
constexpr int null = 0, * p = null;// p是 top-level const

@lloveuu
Copy link

lloveuu commented Jul 20, 2024

加不加const似乎没关系吧,重点是不能把int变量赋给指针,改正:int null = 0, *p = &null ;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants