有沒有辦法找出指針在數組中的位置?數組指針算術問題
可以說,我們已經做到了這一點:
int nNums[10] = {'11','51','23', ... }; // Some random sequence
int* pInt = &nNums[4]; // Some index in the sequence.
...
pInt++; // Assuming we have lost track of the index by this stage.
...
有沒有辦法來確定哪些元素索引數組pInt
的是「指點」無須重新走陣?
對不起,按照目前的措辭,這沒有意義的我。 – 2010-03-31 17:06:04
輕微重寫。 – Konrad 2010-03-31 17:08:45
int * pInt = nNums [4];'需要'int * pInt =&nNums [4];'。 – 2010-03-31 17:13:13