📄 structptr.cc
字号:
#include <iostream>
using namespace std;
struct Date{
int year;
int month;
int day;
};
int main()
{
Date d1={2008,8,14}, d2={2005,10,1};
Date* p=NULL;
p = &d1;// p point to d1
cout << (*p).year << '-' << (*p).month << '-' << (*p).day << endl;
cout << p->year << '-' << p->month << '-' << p->day << endl;
p = &d2;
cout << p->year << '-' << p->month << '-' << p->day << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -