#include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node *next;
} Node;
Node *head;
void list_init() {
head=(Node *)malloc(sizeof(Node));
}
Node *InsertNode (Node *Target, Node *Next) {
Node *temp;
temp = (Node *)malloc(sizeof(Node));
*temp = *Next;
temp -> next = Target -> next;
Target -> next = temp;
return temp;
}
int main(void) {
int i;
Node *Now, Temp;
list_init();
Now = head;
for(i=1; i<=5; i++) {
Temp.data = i;
Now = InsertNode(Now, &Temp);
}
for(Now=head->next; Now; Now=Now->next)
printf("%d\t", Now->data);
puts("");
return 0;
}
오랜만에 했더니 존나 헷갈리네
실행시켰더니 출력은하는데 튕긴다
디버깅은 너의 몫!
이새끼 코딩더럽게못하네
미안 ㅅㅂ C존나싫어서