gpt4 book ai didi

c - 非常基本的 C 问题

转载 作者:太空宇宙 更新时间:2023-11-04 00:23:03 26 4
gpt4 key购买 nike

如果我错了,有人可以检查我的理解并纠正我吗?

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?

很抱歉这个基本问题 - 我很快就有一个 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

关于c - 非常基本的 C 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2271613/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com