We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
(b) int *const p2 = &i2; 应该是不合法的。 我自己代码尝试了一下,会返回报错“error: cannot initialize a variable of type 'int *const' with an rvalue of type 'const int * “
我理解的原因是由于i2是一个常量,而常亮的地址只能被存放在 指向常量的指针中。p2是一个常量指针,而非 指向常量的指针。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
(b) int *const p2 = &i2; 应该是不合法的。
我自己代码尝试了一下,会返回报错“error: cannot initialize a variable of type 'int *const' with an rvalue of type 'const int * “
我理解的原因是由于i2是一个常量,而常亮的地址只能被存放在 指向常量的指针中。p2是一个常量指针,而非 指向常量的指针。
The text was updated successfully, but these errors were encountered: