inherit: Used variables different from strings

This commit is contained in:
Logen Kain 2017-01-25 20:32:44 -07:00
parent 74fa6bea32
commit 301d91a371

View File

@ -2,6 +2,8 @@
#include <string.h>
int main ()
{
typedef struct
{
@ -15,18 +17,17 @@ int main ()
char brand[10];
}Car;
Car ford;
ford.vehicle.life = 5;
ford.vehicle.magic = 9;
strcpy(ford.brand, "Ford");
Car myCar;
myCar.vehicle.life = 5;
myCar.vehicle.magic = 9;
strcpy(myCar.brand, "Dodge");
printf("The car's life is: %d\n" "The car's magic is: %d\n"
"The car's brand is: %s\n", ford.vehicle.life, ford.vehicle.magic,
ford.brand);
"The car's brand is: %s\n", myCar.vehicle.life, myCar.vehicle.magic,
myCar.brand);
//code
}