?? p1-47.cpp
字號:
#include<iostream.h>
main()
{
//聲明數(shù)組、變量和指針變量
int a[]={1,2,3,4,5,6};
int *ip1,*ip2;
//測試指針的賦值運算
ip1=a;
ip2=ip1;
cout<<"*ip1="<<(*ip1)<<endl;
cout<<"*ip2="<<(*ip2)<<endl;
//測試指針的自增自減運算和組合運算
ip1++;
ip2+=4;
cout<<"*ip1="<<(*ip1)<<endl;
cout<<"*ip2="<<(*ip2)<<endl;
//測試指針變量之間的關(guān)系運算
int n=ip2>ip1;
cout<<"ip2>ip1="<<n<<endl;
cout<<"ip2!=NULL="<<(ip2!=NULL)<<endl;
//指針變量之間的減法
n=ip2-ip1;
cout<<"ip2-ip1="<<n<<endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -