结构体
2024-05-18 20:59:11
发布于:广东
内存上限
堆栈空间(全局)
函数->栈空间(超了栈溢出)
指针
1.定义
int *p=&a;//p指向a的地址
2.指针
链表
//初始化
node *head;//定义头指针指向空节点
node *tail;//尾指针
head=new node;
head->nxt=NULL;
tail=head;
//插入
cin>>a>>b;//在a后面插b
for(node *tmp=head->nxt;tmp!=NULL;tmp=tmp->nxt){
if(tmp->data==a){
node *c=new node;
c->data=b;
c->nxt=tmp->nxt;
tmp->nxt=c;
break;
}
}
for(node *tmp=head->nxt;tmp!=NULL;tmp=tmp->nxt){
cout<<tmp->data<<" ";
}
//删除
for(node *tmp=head->nxt;tmp!=NULL;tmp=tmp->nxt){
错误类型
1.WA(wrong answer)
答案错误
2.huaweidnegu
这里空空如也
有帮助,赞一个