Last active
June 11, 2024 04:02
-
-
Save oknauta/5d22de72fd7f6a1c0ffb786fe03fb84c to your computer and use it in GitHub Desktop.
Using `struct` to create an information.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************** | |
* File: ford_car.c | |
* Date: 2024-06-11 | 2024-06-11 | |
**************************************/ | |
#include <stdio.h> | |
#define FORD_BRAND "Ford" | |
#define FORD_CAR_MODEL "F3310" | |
#define FORD_CAR_F3310_YEAR 2024 | |
struct car | |
{ | |
char *brand; | |
char *model; | |
unsigned short int year; | |
}; | |
int main() | |
{ | |
struct car ford_car = | |
{ | |
.brand = FORD_BRAND, | |
.year = FORD_CAR_F3310_YEAR, | |
.model = FORD_CAR_MODEL | |
}; | |
printf("Brand:\t%s\nModel:\t%s\nYear:\t%d\n", ford_car.brand, ford_car.model, ford_car.year); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment