構造体のメンバの初期化
明解C言語 入門編 > 12. 構造体 >
構造体のメンバの初期化
Perl
%sanaka = (name => "Sanaka", height => 175, weight => 60.5); printf("氏名:%s\n", $sanaka{"name"}); printf("身長:%d\n", $sanaka{"height"}); printf("体重:%f\n", $sanaka{"weight"}); print "\n"; %sanaka = ("name", "Sanaka", "height", 175, "weight", 60.5); printf("氏名:%s\n", $sanaka{"name"}); printf("身長:%d\n", $sanaka{"height"}); printf("体重:%f\n", $sanaka{"weight"});
実行結果
L:\>perl lesson_12_091.pl
氏名:Sanaka
身長:175
体重:60.500000氏名:Sanaka
身長:175
体重:60.500000