回覆列表
  • 1 # 湯圓電影Vlog

    #include <stdio.h> #include <malloc.h> #include <string.h>#define N 5typedef struct node { char number[10]; int data; struct node *next; }node; node * create() { node *p,*s,*h; char number[10];int j=1,x; p=s=h=(node*)malloc(sizeof(node)); h->next=NULL; printf("please input the data to create the list,end with -1 or %d numbers\n",N); while(x!=-1&&j<=N) { printf("input name:"); scanf("%s",number);printf("input age:"); scanf("%d",&x); s=(node*)malloc(sizeof(node)); s->data=x; strcpy(s->number,number);if(h->next==NULL) h->next=s; else p->next=s; p=s; j++; } p->next=NULL; return h; } int main() { node *p; p=create() ; return 0; }

  • 中秋節和大豐收的關聯?
  • 怎樣防止水管被凍住?