finished up the tutorial
This commit is contained in:
parent
3122fe9d50
commit
03d6e445fe
1 changed files with 16 additions and 1 deletions
17
main.c
17
main.c
|
|
@ -11,6 +11,12 @@ struct man {
|
||||||
char relationship_status[10];
|
char relationship_status[10];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// UNION TEST
|
||||||
|
union woman {
|
||||||
|
int age;
|
||||||
|
int weight;
|
||||||
|
};
|
||||||
|
|
||||||
int multiply(int num_one, int num_two) {
|
int multiply(int num_one, int num_two) {
|
||||||
int result = num_one*num_two;
|
int result = num_one*num_two;
|
||||||
return result;
|
return result;
|
||||||
|
|
@ -102,10 +108,19 @@ int main() {
|
||||||
printf("%s", message);
|
printf("%s", message);
|
||||||
|
|
||||||
// STRUCTURES
|
// STRUCTURES
|
||||||
printf("\n\nSTRUCTURE (peter) BELOW:\n"); // DIVIDER
|
printf("\n\nSTRUCTURE (man) BELOW:\n"); // DIVIDER
|
||||||
struct man PETER={"Peter", "Griffin", 35, 150, "married"};
|
struct man PETER={"Peter", "Griffin", 35, 150, "married"};
|
||||||
printf("Our man is named %s %s, he is %d years old, he weights %dkg and his relationship status is %s.", PETER.firstname, PETER.surname, PETER.age, PETER.weight, PETER.relationship_status);
|
printf("Our man is named %s %s, he is %d years old, he weights %dkg and his relationship status is %s.", PETER.firstname, PETER.surname, PETER.age, PETER.weight, PETER.relationship_status);
|
||||||
|
|
||||||
|
// UNIONS
|
||||||
|
printf("\n\nUNION (woman) BELOW:\n"); // DIVIDER
|
||||||
|
union woman LOIS;
|
||||||
|
LOIS.age = 34;
|
||||||
|
LOIS.weight = 60;
|
||||||
|
printf("Our woman is unknown, she is not %d years old and she weights %dkg. (LOIS.age and LOIS.weight).", LOIS.age, LOIS.weight);
|
||||||
|
|
||||||
// END
|
// END
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
// THIS IS THE CURRENT END OF MY LESSON
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue