Structures
This commit is contained in:
parent
3fc465b05e
commit
3122fe9d50
1 changed files with 13 additions and 0 deletions
13
main.c
13
main.c
|
|
@ -2,6 +2,14 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
// STRUCTURE TEST
|
||||||
|
struct man {
|
||||||
|
char firstname[20];
|
||||||
|
char surname[20];
|
||||||
|
int age;
|
||||||
|
int weight;
|
||||||
|
char relationship_status[10];
|
||||||
|
};
|
||||||
|
|
||||||
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;
|
||||||
|
|
@ -93,6 +101,11 @@ int main() {
|
||||||
char message[22]="Hello, world. Again...";
|
char message[22]="Hello, world. Again...";
|
||||||
printf("%s", message);
|
printf("%s", message);
|
||||||
|
|
||||||
|
// STRUCTURES
|
||||||
|
printf("\n\nSTRUCTURE (peter) BELOW:\n"); // DIVIDER
|
||||||
|
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);
|
||||||
|
|
||||||
// END
|
// END
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue