inherit: Used variables different from strings
This commit is contained in:
parent
74fa6bea32
commit
301d91a371
@ -2,6 +2,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
int main ()
|
int main ()
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -15,18 +17,17 @@ int main ()
|
|||||||
char brand[10];
|
char brand[10];
|
||||||
}Car;
|
}Car;
|
||||||
|
|
||||||
Car ford;
|
Car myCar;
|
||||||
ford.vehicle.life = 5;
|
myCar.vehicle.life = 5;
|
||||||
ford.vehicle.magic = 9;
|
myCar.vehicle.magic = 9;
|
||||||
strcpy(ford.brand, "Ford");
|
strcpy(myCar.brand, "Dodge");
|
||||||
|
|
||||||
printf("The car's life is: %d\n" "The car's magic is: %d\n"
|
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,
|
"The car's brand is: %s\n", myCar.vehicle.life, myCar.vehicle.magic,
|
||||||
ford.brand);
|
myCar.brand);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//code
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user