标题:求解,这个程序那个地方错了???
取消只看楼主
wen9501
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-10-26
 问题点数:0 回复次数:0 
求解,这个程序那个地方错了???
#include<stdio.h>
#include<stdlib.h>
struct temp{
    int data;
    struct temp *next;
};
int main()
{
    int i;
    struct temp *p=NULL,*head=NULL,*pt=NULL;
    for(i=0;i<5;i++)
    {
    p=(struct temp *)malloc(sizeof(struct temp));
    if(p==NULL) { printf("wrong");
    break;
    }
    printf("enter a number:\n");
    scanf("%d",&p->data );
   if(i==1) head=p;
   pt->next =p;
   pt=pt->next ;
   pt->next =NULL;
    }
    printf("these numbers:") ;
    p=head;
    while(p)
    {
    printf("%d",p->data );
    p=p->next ;
    }
    return 0;
}
搜索更多相关主题的帖子: include numbers wrong 
2016-10-26 16:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-470294-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.672237 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved