Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define BASE_YEAR 1900
- struct date {
- unsigned short day : 5;
- unsigned short month : 4;
- unsigned short year : 7;
- };
- int main() {
- struct date birthday;
- birthday.day = 14;
- birthday.month = 3;
- birthday.year = 2003 - BASE_YEAR;
- printf("\n My birthday is %u.%u.%u \n", birthday.day, birthday.month, birthday.year + BASE_YEAR);
- printf("\n Size of birthday structure is %lu bytes", sizeof(birthday));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement