新人求助。 链表的创建和输出
											 程序代码:
程序代码:#include<stdio.h>
#include<malloc.h>
struct ok{
    int a;
    int b;
    struct ok *next;
}; 
int n;
struct ok *creat(){
    n=0;
    struct ok *p1,*p2,*head;
    p1=p2=(struct ok*)malloc(sizeof(struct ok));
    scanf("%d,%d",&p1->a,&p1->b);
    head=NULL; 
    for(;p1->b!=0;){
        n=n+1;
        if(n==1)head=p1;
        else p2->next=p1;
        
            
        p2=p1;
        p1=(struct ok*)malloc(sizeof(struct ok));
        scanf("%d,%d",&p1->a,&p1->b);
        
    }
    p2->next=NULL;
    return head;
}
void print(struct ok *head){
    struct ok *p=head;
    if(head!=NULL){
    
        do{
        printf("%d,%d\n",p->a,p->b);
        p=p->next;}
    while(p!=NULL);
    }
}
void main(){
    struct ok *head;
    head=creat();
    print(head);
    
    
}										
					
	
 
											





