作者mimi9126 (烦呀)
看板b98902HW
标题[计程] typedef实验
时间Tue Nov 17 16:43:27 2009
我不熟这个语法,所以直接讲实验结果
struct a { ... } b; b是一个variable
typedef struct a { ... } b; b是type
typedef struct { ... } b; b是type
typedef struct { ... }; compile能过,但不知道能干嘛
struct { ... } b; b是一个variable
结论: typedef的效果是把最後一个identifier拿来当作前面的型态的缩写
否则,後面的identifier会当作前面type的variable declaration
吧
想玩的话自己实验看看,基本上会用到的形式就那一两种
--
Looking for the place where a heart feels at ease.
Then, aim at the new future.
While it doesn't know, scene changes someday,
and very warm wind will blow in place.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.3.52
1F:推 davll:我不懂这是什麽意思,b不能用? struct a{...}b; b是实体啊? 11/17 16:48
2F:→ mimi9126:喔了,我重新改一下 11/17 16:52
应该是这样吧,我跟这语法超不熟,有错的话请同学再指出
※ 编辑: mimi9126 来自: 140.112.3.52 (11/17 17:05)