From 301d91a37127bbce1c00a825abd16463a8f26d46 Mon Sep 17 00:00:00 2001 From: Logen Kain Date: Wed, 25 Jan 2017 20:32:44 -0700 Subject: [PATCH] inherit: Used variables different from strings --- inherit/main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/inherit/main.c b/inherit/main.c index 32b7a0f..9fce1aa 100644 --- a/inherit/main.c +++ b/inherit/main.c @@ -2,6 +2,8 @@ #include 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 }