#include <iostream> using namespace std;</iostream>
typedef struct test* t;
struct test
{
int v;
struct test* next;
};
int main()
{
t a;
a->v=1;
a->next =nullptr;
}
编译居然莫名其妙报了一个警告:
test.cpp:18:3: warning: variable 'a' is uninitialized when used here [-Wuniniti
alized]
a->v=1;
^
test.cpp:14:6: note: initialize the variable 'a' to silence this warning
t a;
^
= NULL
1 warning generated.
好吧 如他所愿改成
t a=NULL;
结果看的我直接迷了,Segmentation fault:11
????????