Example 101: Store Information Using Bit Fields

Learn how to use bit fields in a struct.

We'll cover the following


Write a program to read and store information about the insurance policyholder. The information contains gender, whether the holder is minor/major, policy name, and policy duration. Make use of bit fields to store this information.

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.