指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
指针(pointer——C/C++的精华!你不得不学好它!
指针(pointer
pointer)――CC的精华.
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
char*nm="Nice";charname[]="OK";
cout<<"Addressesofthepointers'nm'and'name'themselves:"<<endl;cout<<"'nm'isat"<<&nm<<",'name'isat"<<&name<<endl;
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
cout<setiosflags(ios::uppercase<<"'nm'pointsto0x"<<(intnm;
cout<<",'name'pointsto0x"<<(intname<<endl;
cout<<"Characterstringsare'"<
cout<endl;
}
/*Results:
Addressesofthepointers'nm'and'name'themselves:
'nm'isat0x0065FDF4(栈区),'name'isat0x0065FDF0(栈区)
'nm'pointsto0x42608C(数据区),'name'pointsto0x65FDF0(栈区)
Characterstringsare'Nice'and'OK'respectively.
*/
说明:我在编程时的数据与此相差很大,读者需要自行地将上述代码运转一下...
程序中cout<<(intname用于读取指针内容即指针所指向的地点(字符串地点);而
cout<则用于读取该指针所指向的字符串内容。
指向指针的指针
比如:
inti=5;
int*ptr=&i;
int**pp=&ptr;
即:
指向指针ptr的指针整型变量i的指针整型变量
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
pp
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
指针(pointer)――CC的精华.
ptr=&i
i=5
可表示为:
i=*ptr;
或
i=**pp;
指针数组(array
指针(pointer)――CC精髓 来自淘豆网m.daumloan.com转载请标明出处.