address.cc
来自「资深C++讲师授课代码」· CC 代码 · 共 29 行
CC
29 行
#include <iostream>
using namespace std;
#include <string>
struct Person{
string name;
bool gender;
int age;
double income;
};
int main()
{
Person furong={"芙蓉", false, 38, 10000};
cout << "&furong=" << &furong << endl;
cout << "&furong.name=" << &furong.name << endl;
//cout << *&furong << endl;//Person*
cout << *&furong.name << endl;//string*
cout << "sizeof(furong)=" << sizeof(furong) << endl;
cout << "sizeof(furong.name)=" << sizeof(furong.name) << endl;
cout << "sizeof(furong.gender)=" << sizeof(bool) << endl;
cout << "sizeof(furong.age)=" << sizeof(furong.age) << endl;
cout << "sizeof(furong.income)=" << sizeof(double) << endl;
cout << "&furong.name=" << &furong.name << endl;
cout << "&furong.gender=" << &furong.gender << endl;
cout << "&furong.age=" << &furong.age << endl;
cout << "&furong.income=" << &furong.income << endl;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?