글수 61
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int data;
struct node * link;
}node;
node * mll(){
int i;
node *tmp,*start;
start=(node*)malloc(sizeof(node));
tmp=start;
for(i=0;i<3;i++){
tmp->data = i;
tmp->link = (node*)malloc(sizeof(node));
tmp = tmp->link;
}
tmp->data =i;
tmp->link =NULL;
return start;
}
void pl(node *start){
node *tmp;
printf("%d n",start->data);
tmp = start->link;
while(1){
printf("%d n",tmp->data);
if(tmp->link == NULL)break;
tmp = tmp->link;
}
}
main(){
node *start = mll();
pl(start);
}


