如果我错了,有人可以检查我的理解并纠正我吗?
int p = 5; //create an int holding 5
int *ptr; //create a pointer that can point to an int
*ptr = &p; // not sure - does this mean that my pointer now points to memory address five, or that the memory address my pointer points at contains 5?
Run Code Online (Sandbox Code Playgroud)
对不起基本的问题 - 我很快就有一个需要使用指针的assignmnet,我真的想在它设置之前破解基础知识.
几乎在那里 - 改为:
int p = 5; // create an int holding 5
int *ptr; // create a pointer that can point to an int
ptr = &p; // ptr now points at p
Run Code Online (Sandbox Code Playgroud)