作者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)