What Is Making Bit Field.

1 month ago
C Programming

#include <stdlib.h>

#include <stdio.h>

#include <stdint.h>

struct {

uint32_t year:23;

uint32_t day:5;

uint32_t month:4;

} typedef Bitfield;

int main() {

Bitfield date = {2020, 13,12 };

printf(“sizeof Bitfield: %lu bytes\n”, sizeof(date));

printf(“date: %d/%d/%d \n”, date.day, date.month, date.year);

return EXIT_SUCCESS;

}

 

Output

sizeof Bitfield: 4 bytes

cdate: 13/12/2020

Rusma Khadka
Dec 27, 2022
More related questions

Questions Bank

View all Questions

Top