#include <stdio.h>
int main()
/*
fridge=0:代表没有冰箱
washMachine=0:没有洗衣机
*/
struct home
{
int fridge;
int washMachine;
struct home *p;
};
int main(){
struct home liHome,tongHome,huHome;
liHome.fridge=1;
liHome.washMachine=0;
liHome.p=&tongHome;
tongHome.fridge=0;
tongHome.washMachine=1;
tongHome.p=&huHome;
huHome.fridge=1;
huHome.washMachine=1;
huHome.p=NULL;
struct home *temp=&liHome;
for (; temp!=NULL; temp=temp->p)
{
printf("冰箱=%d,洗衣机=%d\n",temp->fridge,temp->washMachine);
}
/*
struct home *pLi=&liHome;
//小李家
printf("小李家冰箱=%d,洗衣机=%d\n",pLi->fridge,pLi->washMachine);
struct home *pTong=pLi->p;
//童歌家 printf("童歌家冰箱=%d,洗衣机=%d\n",pTong->fridge,pTong->washMachine);
struct home *pHu=pTong->p;
printf("胡歌家冰箱=%d,洗衣机=%d\n",pHu->fridge,pHu->washMachine);
*/
return 0;
}