[問題] struct 宣告

看板C_and_CPP (C/C++)作者 (牛頓運動定律)時間15年前 (2011/03/08 18:34), 編輯推噓0(007)
留言7則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) C++ or C 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 問題(Question): struct abc_1; typedef struct abc_1 def_1; struct abc_2{ }; typedef struct abc_2 def_2; int main(){ system("pause"); } 請問一下def_1跟def_2的差別?? 這裡的def_1是跟void效果一樣嗎?? 看到這CODE不知如何解釋 感謝!! 餵入的資料(Input): 預期的正確結果(Expected Output): 錯誤結果(Wrong Output): 程式碼(Code):(請善用置底文網頁, 記得排版) 補充說明(Supplement): -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.118.122.154

03/08 18:36, , 1F
你有去查詢過 typedef 這個字的意義嗎?
03/08 18:36, 1F

03/08 18:37, , 2F
這裡的def_1是跟void效果一樣嗎?? <= 否,它跟void無關
03/08 18:37, 2F

03/08 18:39, , 3F
我知道阿~只是第一種struct方式 只是一個宣告 是這樣解釋
03/08 18:39, 3F

03/08 18:39, , 4F
嗎?如果只是宣告那有站記憶體??
03/08 18:39, 4F

03/08 18:44, , 5F
喔喔,第一種叫做 Forward declaration
03/08 18:44, 5F

03/08 18:45, , 6F
拿這個字去google就可以找到相關資料了
03/08 18:45, 6F

03/08 20:30, , 7F
thx 我再看看
03/08 20:30, 7F
文章代碼(AID): #1DTWPDKW (C_and_CPP)
文章代碼(AID): #1DTWPDKW (C_and_CPP)