标题:关于数据结构的问题(2)
取消只看楼主
lufeng1720
Rank: 1
等 级:新手上路
帖 子:21
专家分:6
注 册:2009-10-30
结帖率:100%
已结贴  问题点数:20 回复次数:2 
关于数据结构的问题(2)
#include <stdio.h>
#include <stdlib.h>
typedef struct stacknode
{int data;
    struct stacknode *next;
}stacknode,* linkstack;
linkstack top;
void push(linkstack top,int x)
{stacknode *p=new stacknode;
    p->data=x;
    p->next=top;
    top=p;
}
int pop(linkstack top)
{int x;
    stacknode *p=top;
    x=p->data;
    top=p->next;
    free (p);
    return x;
}
void showstack(linkstack top)
{stacknode *p=top;
    if(p==NULL)
    printf("it is kong");
    else
    {printf("it is:");
        while(p!=NULL)
        {printf("%6d",p->data);
            p=p->next;
        }
        printf("\n");
}}
main()
{linkstack top=NULL;
push(top,1);
push(top,2);
printf("%5d",pop(top));
请顺便看看这个吧!!!!!!!!!!!!!!也运行不了啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!为什么????????????????????????????????????
搜索更多相关主题的帖子: 数据结构 
2010-04-21 16:55
lufeng1720
Rank: 1
等 级:新手上路
帖 子:21
专家分:6
注 册:2009-10-30
得分:0 
不胜感激啊!!!!!!!!!!!!!!!!!!!!!!!
2010-04-21 23:07
lufeng1720
Rank: 1
等 级:新手上路
帖 子:21
专家分:6
注 册:2009-10-30
得分:0 
谢谢啊 !!!!!!!!高手啊!!!!以后多指教小弟啊!能不能加我qq啊?以后有不懂的可以问你啊!我的qq是495273822!!!!
2010-04-21 23:09



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




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

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