對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] ...