我正在学习cpp并需要一些帮助.我的代码无效,它停止了add->value = value.
typedef struct node node;
struct node{
int value;
struct node *next;
};
node *top;
int insert(int value){
struct node *add;
cout<< "here it stops";
add->value = value;
add->next = NULL;
if(top == NULL ){
top == add;
}else{
add->next = top;
top = add;
}
}
Run Code Online (Sandbox Code Playgroud)