2017-01-25 20:14:19 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
int main ()
|
2017-01-25 20:32:44 -07:00
|
|
|
|
|
|
|
|
2017-01-25 20:14:19 -07:00
|
|
|
{
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
int life;
|
|
|
|
int magic;
|
|
|
|
}Vehicle;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Vehicle vehicle;
|
|
|
|
char brand[10];
|
|
|
|
}Car;
|
|
|
|
|
2017-01-25 20:32:44 -07:00
|
|
|
Car myCar;
|
|
|
|
myCar.vehicle.life = 5;
|
|
|
|
myCar.vehicle.magic = 9;
|
|
|
|
strcpy(myCar.brand, "Dodge");
|
2017-01-25 20:14:19 -07:00
|
|
|
|
|
|
|
printf("The car's life is: %d\n" "The car's magic is: %d\n"
|
2017-01-25 20:32:44 -07:00
|
|
|
"The car's brand is: %s\n", myCar.vehicle.life, myCar.vehicle.magic,
|
|
|
|
myCar.brand);
|
2017-01-25 20:14:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|