MIPI_AdvancedC_FRTK/Lect1/08_page_15.c
2024-11-14 08:45:50 +03:00

15 lines
386 B
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include <stdint.h>
struct date {
uint16_t day : 5; // значение от 0 до 31
uint16_t month : 4; // значение 0 до 15
uint16_t year;//: 7; если огранчить с 2000 до 2064 года
};
int main(void)
{
struct date dt = { 31, 12, 2021 };
dt.month = 16;
printf("Date is %u/%u/%u", dt.day, dt.month, dt.year);
}