| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 498 人关注过本帖
标题:栈的运算
只看楼主 加入收藏
飞扬hu
Rank: 2
等 级:论坛游民
帖 子:36
专家分:22
注 册:2011-6-17
结帖率:66.67%
收藏
 问题点数:0 回复次数:1 
栈的运算
#include<stdio.h>
#include<stdlib.h>
void init_stack(int*s,int m,int*top) //建立一个空栈的顺序存储空间
{    s=malloc(m*sizeof(int));
    top=malloc(sizeof(int));
    *top=0;return;
}
void push(int*s,int m,int*top,int x) //进栈函数
 {    if(*top==m)
    {        printf("Stackflow\n"); return ;}
        *top=*top+1;
    s[*top-1]=x;
    return ;
}
void main( void)
{    int i,n,m ,t=15;//t为栈的长度
    int*top,*s;
    init_stack(s,t,top); //建立一个空栈
    printf("input n(<15) numbers:");
    scanf("%d",&m);
    printf("input numbers:");
    for(i=0;i<m;i++)
    {    scanf("%d",&n);
        push(s,t,top,n);
    }
    printf("要插入的数:");
    scanf("%d",&n);
    push(s,t,top,n);
    return;
 }
搜索更多相关主题的帖子: 空间 include numbers return 
2011-11-07 19:44
飞扬hu
Rank: 2
等 级:论坛游民
帖 子:36
专家分:22
注 册:2011-6-17
收藏
得分:0 
为什么编译没错,但是调试通不过啊,下面提示这Loaded 'C:\WINDOWS\system32\imm32.dll', no matching symbolic information found.
2011-11-07 19:46
快速回复:栈的运算
数据加载中...
 
   



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

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