首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

结构体小疑点

2013-09-27 
结构体小问题typedef int ElemTypetypedef struct sqstack{ElemType *topElemType *bottomint stacksiz

结构体小问题
typedef int ElemType;
typedef struct sqstack
{
        ElemType *top;
        ElemType *bottom;
        int stacksize;
}sqStack;
在main中使用
void main()
{
    sqstack a;
   // sqStack a; 这两种方式我测试了下都正确,求教大侠有什么区别吗?
        
    getchar();


[解决办法]
c++里面没区别,c里面的话sqstack 前边要加struct,不然编译报错
[解决办法]
google下 typedef的用法
[解决办法]
有些人喜欢struct sqstack a,而有些人喜欢sqStack a

引用:
typedef int ElemType;
typedef struct sqstack
{
        ElemType *top;
        ElemType *bottom;
        int stacksize;
}sqStack;
在main中使用
void main()
{
    sqstack a;
   // sqStack a; 这两种方式我测试了下都正确,求教大侠有什么区别吗?
        
    getchar();

[解决办法]
这个实在C++里测试的吧,在linux C里是通不过的。

热点排行