■ソースコード
#include <stdio.h>
#include <string.h>
// 文字列処理に string.h が必要
struct person{ // 個人データ
char name[40]; // 名前
int height; // 身長
int weight; // 体重
}; // セミコロン「;」が必要
int main(void){
struct person p;
strcpy(p.name,"鈴木一郎");
p.height=180;
p.weight=70;
printf("名前=%s,身長=%d,体重=%d\n",
p.name,p.height,p.weight);
}
■実行結果
>hellostruct.exe
名前=鈴木一郎,身長=180,体重=70