最終更新:2018-10-25 (木) 16:40:19 (1981d)
struct
Top / struct
構造体を定義
//構造体を定義 struct point{ int x; int y } //変数を宣言 struct point pt; pt.x=10; pt.y=20;
typedef struct
- C言語ではtypedefしておかないと構造体を使用するとき毎回structと記述する必要があるため、typedefで型定義しておくことが多い。
- C++ではstructで定義したものはstructと付けなくても宣言可能