#include<stdio.h>
#include<stdlib.h>
struct node {
int data;
struct node* link;
};
int main() {
struct node* ptr;
struct node* A, * B, * C, * D;
A = (struct node*)malloc(sizeof(struct node));
A->data = 17;
B = (struct node*)malloc(sizeof(struct node));
B->data = 29;
A->link = B;
B->link = NULL;
C = (struct node*)malloc(sizeof(struct node));
C->data = 36;
B->link = C;
C->link = NULL;
D = (struct node*)malloc(sizeof(struct node));
D->data = 52;
C->link = D;
D->link = NULL;
for (ptr = A; ptr != NULL; ptr = ptr->link)
printf("%d", ptr->data);
}
자꾸 역참조오류뜨는데 코드가 잘못된거야??
안뜸