我想在堆中声明一个新的整数,
int *intPtr = (int*) malloc(sizeof(int));
如何更改 *intPtr
指向的堆空间值?
谢谢
最佳答案
取消引用intPtr
:
*intPtr = 0;
关于在 C 中更改指向整数的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5692459/
标签 c heap-memory
我想在堆中声明一个新的整数,
int *intPtr = (int*) malloc(sizeof(int));
如何更改 *intPtr
指向的堆空间值?
谢谢
最佳答案
取消引用intPtr
:
*intPtr = 0;
关于在 C 中更改指向整数的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5692459/