Re: TC++ 變數視野求教

看板Programming作者 (要公理要正義)時間18年前 (2008/01/09 16:45), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/12 (看更多)
※ 引述《"marujoung" <maru8888@bbs.emerald.net.tw>, 看板: Programming》之銘言: : 若我將 func1 內的 int i 拿掉, 將 int i 移到 func1 前就正確了. : 不解的是 func1 內的 i 不是 auto 變數嗎? : 理應不會左右後面的外在變數 i 才對, : 且到了 func2 時 i 的值會重設, 而 func1 的 i 沒有進出. : 但事實顯示似乎兩個 i 會互相干擾..... 將變數宣告在函式主體外, 稱之為Global Scope 將變數宣告在函式主體外(且加了static關鍵字), 稱之為File Scope 將變數宣告在函式內, 稱之為Local Scope, 到http://itsoho.myweb.hinet.net參考看看吧. -- =============================== 想討論dotNet嗎? 想知道dotNet嗎? 來這兒逛逛吧! http://netforum.no-ip.biz http://dotnet-project.no-ip.biz =============================== -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.126.240.23
文章代碼(AID): #17X8cndc (Programming)
文章代碼(AID): #17X8cndc (Programming)