C++
- voluntas
- @ignis_fatuus
- ブン
- @Linda_pp
- 清楚なC++メイドBOT
- @tzik_tack
- 長谷川一輝
- wraith13
- @jj1bdx
- @cpp_akira
- 安藤敏彦
- @srz_zumix
- Siv3D
- @okdshin
- @hnokx
- @ishidakei
- @take_cheeze
- TAKEI Yuya
- @mumumu
- I (@wx257osn2)
- Tommy6
- わたやん
- @KorekaraSEDB
- @kariya_mitsuru
- @ciniml
- @beam2d
- @grafi_tt
- @nekketsuuu
- LouiS0616
- @volanja
- 大鎌広
- むてら
- ガチKGB
- 三重野賢人
x
25
1
2
using std::cout;
3
using std::endl;
4
5
typedef struct
6
{
7
int Day;
8
char *pMonth; // pointer to full name "January", "February", ...
9
int Year; // AD, for example 2019
10
} DATE3;
11
12
int main(void) {
13
char m[] = "January";
14
struct item_type {
15
DATE3 Date;
16
} item = {{12, m, 2020}};
17
item_type* item_ptr = &item;
18
19
DATE3 date_ptr = item_ptr->Date;
20
21
cout << "Day: " << date_ptr.Day << endl;
22
cout << "Year: " << date_ptr.Year << endl;
23
cout << date_ptr.pMonth;
24
}
25
$ g++ prog.cc -Wall -Wextra -std=c++2a -pedantic
Start
Day: 12 Year: 2020 January
0
Finish