【发布时间】:2020-04-25 14:28:35
【问题描述】:
#include <stdio.h>
void test(void **arg) {
int foo = 3;
**(int **)arg = foo; // I want to just fix this line!!
}
int main(void) {
int temp = 0;
printf("%d\n", temp);
test((void **)&temp);
printf("%d\n", temp);
return 0;
}
在我的代码中,出现“分段错误”问题,但我不知道如何修复我的代码..
我只想修复 **(int **)arg = foo; 行。
有人可以帮帮我吗?
【问题讨论】:
标签: c pointers segmentation-fault