/* t4_2.c ( PASCAL講座 sample program ) レコードのサンプル コンパイル命令は gcc t4_2.c -o t4_2 実行命令は t4_2 */ #include #include main() { struct { char id[255]; char name[255]; char tele[255]; int age; } x; sprintf(x.id,"04ss999"); sprintf(x.name,"Jiro Tosa"); sprintf(x.tele,"844xxxx"); x.age=22; printf("ID : %s\n",x.id); /* C では with 文に該当するものがない */ printf("Name : %s\n",x.name); printf("Age : %1d\n",x.age); printf("Telephone Number : %s\n",x.tele); }