[問題] 結構初始化
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
gcc
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
結構初始化問題
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
正確版:http://ideone.com/jb3AQP
錯誤版:http://ideone.com/VEUexX
這兩個code,差別在於錯誤版是struct 後,
直接給一個結構變數start,
然後再設定start這個初始值,
但是compiler以後卻不能過,這是為什麼?
因為把初始值(14、15行)拿掉後,又可以compiler。
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.73.48.51
※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1415465585.A.2C6.html
推
11/09 01:06, , 1F
11/09 01:06, 1F
→
11/09 01:06, , 2F
11/09 01:06, 2F
→
11/09 01:34, , 3F
11/09 01:34, 3F
推
11/09 01:55, , 4F
11/09 01:55, 4F
→
11/09 01:55, , 5F
11/09 01:55, 5F
→
11/09 02:58, , 6F
11/09 02:58, 6F
→
11/09 14:00, , 7F
11/09 14:00, 7F
推
11/09 20:44, , 8F
11/09 20:44, 8F
→
11/09 20:51, , 9F
11/09 20:51, 9F