...

/

Example 100: Sort Dates Using Bit Fields

Example 100: Sort Dates Using Bit Fields

Learn how to use bit fields in a struct.

We'll cover the following...

Problem

Write a program that stores information about a date in a structure containing three members: day, month, and year.

Using bit fields, the day number should get stored in the first 5 bits, the month number in 4 bits, and the year in 12 bits.

Write a ...