KAIHATSUGIKEN GROUP

C PROGRAMMING LANGUAGE




********************************************************************************
19 構造体のポインタ変数
************
main()
{
struct child{char name[10];int age,height;};
struct child x;
struct child *y;
sprintf(x.name,"taro");x.age=6;x.height=120;
y=&x;
printf("%s,%d,%d\n",y->name,y->age,y0>height);
}
****
taro,6,120
****
main()
{
struct child{char name[10];int age,height;};		/* 構造体の型枠宣言 */
struct child x;
struct child *y;
sprintf(x.name,"taro");x.age=6;x.height=120;
y=&x;
printf("%s,%d,%d\n",y->name,y->age,y0>height);
}
****
taro,6,120
****
main()
{
struct child{char name[10];int age,height;};
struct child x;			 			/* 構造体の変数宣言 */
struct child *y;
sprintf(x.name,"taro");x.age=6;x.height=120;
y=&x;
printf("%s,%d,%d\n",y->name,y->age,y0>height);
}
****
taro,6,120
****
main()
{
struct child{char name[10];int age,height;};
struct child x;
struct child *y;
sprintf(x.name,"taro");x.age=6;x.height=120;	     /* 構造体変数へ値を代入 */
y=&x;
printf("%s,%d,%d\n",y->name,y->age,y0>height);
}
****
taro,6,120
****
main()
{
struct child{char name[10];int age,height;};
struct child x;
struct child *y;				   /*構造体のポインタ変数宣言 */
sprintf(x.name,"taro");x.age=6;x.height=120;
y=&x;
printf("%s,%d,%d\n",y->name,y->age,y0>height);
}
****
taro,6,120
****
main()
{
struct child{char name[10];int age,height;};
struct child x;
struct child *y;
sprintf(x.name,"taro");x.age=6;x.height=120;
y=&x;			   		/* 構造体のポインタ変数にアドレス代入 */
printf("%s,%d,%d\n",y->name,y->age,y0>height);
}
****
taro,6,120
****
main()
{
struct child{char name[10];int age,height;};
struct child x;
struct child *y;
sprintf(x.name,"taro");x.age=6;x.height=120;
y=&x;
printf("%s,%d,%d\n",y->name,y->age,y0>height);  /*yを介してxの構成要素を表示 */
}
****
taro,6,120
****
main()
{
struct child{char name[10];int age,height;};
struct child x;
struct child *y;
sprintf(x.name,"taro");x.age=6;x.height=120;
y=&x;
printf("%s,%d,%d\n",y->name,y->age,y0>height);     /* ポインタ変数 -> 要素名 */
}
****
taro,6,120