對C++中指標的深入研究<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
王根義
摘 要:本文對C++各種型別的指標進行了深刻全面地討論,把各種指標的常量,變數的宣告、賦值和訪問都11列出,這對利用指標開發大型軟體的程式設計師來說無疑是1個非常有力的工具。本文還揭示了指標變數與陣列名的內在關係,以及類的靜態資料指標與非靜態資料指標的根本區別。
關鍵詞:指標型別、指標常量、指標變數、陣列名
【文獻標識碼】A 【文章編號】1728-2462(2008)06-0070-02
Abstract:All kinds of pointers in C++ are thoroughly and deeply constant quantity,variables,the form of endowing with value and access to data are listed like a is undoubtedly a useful tool to a programmer who develops big author bring to light the relationship between the pointer variables and the name of number also reveals the essential distinction between a static pointer and non-static pointer.
Keywords:pointer type data,pointer constant quantity,pointer variable,a number group’s name
C++中的`“指標”實質上是指標型別的資料,所以指標既有常量,也有變數。但是人們往往只是簡單的說“指標”,沒有帶“常量”或“變數”2字。那麼,該“指標”到底是指常量呢還是指變數呢?這個問題要根據它所屬的那個整句才能回答。C++中的指標按照它所指向的物件可以劃分為變數指標、陣列指標、函式指標、物件指標、類的成員資料指標和類的成員函式指標。
1、變數指標
設type代表任意1種基本型別說明符,X是該型別的變數,則:
1、
[1] ...