标题:c语言程序运行结果正确 可最后出来一个停止运行的框
只看楼主
利维尔
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-10-22
 问题点数:0 回复次数:0 
c语言程序运行结果正确 可最后出来一个停止运行的框
#include<stdio.h>
#include<stdlib.h>
typedef struct Node
{
    int Data;
    struct Node *Next;
}Node,*Linkedlist;
Linkedlist LinkedListCreatT()
{
    Node *L;
    L->Next=NULL;
    int x;
    Node *pre;
    pre=L;
    while(scanf("%d",&x)!=EOF)
    {
        Node *p;
        p=(Node*)malloc(sizeof(Node));
        p->Data=x;
        p->Next=NULL;
        pre->Next=p;
        pre=p;        
    }
    return L;
}
Linkedlist LinkedListInsert(Linkedlist L,int i,int x)
{
    Node *q;
    Node *nep;
    q=L;
    int a;
    nep=(Node*)malloc(sizeof(Node));
    while(a!=i-1)
    {   
        q=q->Next;
        a=a+1;
    }   
    nep->Data=x;
    nep->Next=q->Next;
    q->Next=nep;
    return L;
}
int main()
{   Node *start,*p;
    int i,x;
    p=LinkedListCreatT();
    for(start=p->Next;start!=NULL;start=start->Next)
    {
        printf("%d ",start->Data);        
    }
    printf("插入一个数\n");
    scanf("%d %d",&i,&x);     
    LinkedListInsert(p,i,x);
    for(start=p->Next;start!=NULL;start=start->Next)
    {
        printf("%d ",start->Data);        
    }        
}
搜索更多相关主题的帖子: c语言程序 include return 
2015-10-22 12:23



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




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

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