📄 ptr_str02.cpp
字号:
//ptr_str02.cpp
#include <iostream.h>
#include <conio.h>
void main()
{ char *ptr="This is pointer string.";
char s[25];
int i;
cout << "ptr= " << ptr << endl;
for (i=0;i<strlen(ptr)+1; i++)
s[i]=*(ptr+i);
cout << "搬移后 : s=" << s << endl;
ptr++; //ptr=ptr+1;指向第二位置
cout << "ptr++="<<ptr<<endl;
ptr=ptr+4; //跳过4个位置到第6个位置
cout << "ptr+4="<<ptr<<endl;
getch();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -