超究极鸡心
2024-02-20 14:59:01
发布于:北京
#include<bits/stdc++.h>
using namespace std;
struct node{
int data;
node *next;
};
node *head = NULL;
node *tail = NULL;
void print_lst(){
node *step = head;
while(step){
printf("%d ",step->data);
step = step -> next;
}
printf("\n");
}
void append_data(int x){
if(tail == NULL){
head = tail = new node;
}else{
node *new_node = new node;
tail -> next = new_node;
tail = new_node;
}
tail -> data = x;
tail -> next = NULL;
}
int main(){
append_data(1);
append_data(1);
append_data(4);
append_data(5);
append_data(1);
append_data(4);
print_lst();
return 0;
}
这里空空如也
有帮助,赞一个