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

14章问题1的代码 #2

Open
flowingwings opened this issue Aug 1, 2022 · 0 comments
Open

14章问题1的代码 #2

flowingwings opened this issue Aug 1, 2022 · 0 comments

Comments

@flowingwings
Copy link

在书中,题目的要求是

creates a pointer to an integer, sets it to NULL, and then tries to dereference it

,也就是创建一个指向NULL的指针并且dereference它。根据C++ Dereferencing中的解释,dereference就是取值的意思,所以题目的要求应该是尝试访问这个指针,因此代码应该类似于:

int *p = NULL;
int i = *p;

而非在创建指针后将其free。

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

1 participant