Structures

This commit is contained in:
Martin Dvořák 2026-05-21 23:21:31 +02:00
commit 3122fe9d50

13
main.c
View file

@ -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;
} }