想请问一下这个代码哪里有错,谢谢(*°∀°)=3大家
include<stdio.h>#include<stdlib.h>#definelensizeof(structlink_node)structlink_node{in...
include<stdio.h>#include<stdlib.h>#define len sizeof(struct link_node)struct link_node { int number; struct link_node *next;};struct link_node *create(){ struct link_node *head,*p,*q; int mathmatic; head=NULL; while(1) { printf("请输入数字"); scanf("%d",&mathmatic); if(number<0) break; p=(struct link_node *)malloc(len); p->struct link_node.number=mathmatic; if(head==NULL) head=p; else q->next=p; q=p; } if(head!=NULL) q->next=NULL; return head;}void main(){ struct link_node *head; head=create(); printf("链表中的数据\n"); while(head) { printf("%d",head->number); }}
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询