小编use*_*466的帖子

双指针结构

我试图使用一个结构的双指针.构建成功,但在运行时,它会出现以下错误:

运行时检查失败#3 - 正在使用变量'test2'而未进行初始化.

代码是:

testStructure* test1 = (testStructure*)malloc(sizeof(testStructure));
testStructure** test2 ;
test1->Integer = 1;
test1->Double = 4.566;
*test2 = test1;
Run Code Online (Sandbox Code Playgroud)

结构是:

typedef struct{
  int Integer;
  double Double;
} testStructure;
Run Code Online (Sandbox Code Playgroud)

我哪里错了?

c c++

-1
推荐指数
1
解决办法
366
查看次数

标签 统计

c ×1

c++ ×1