Question
Write a program in C that lets a user manipulate bits individually in a 4-byte variable. The program should begin with all bits having a
Write a program in C that lets a user manipulate bits individually in a 4-byte variable. The program should begin with all bits having a value of zero. The program should enter a loop where it prints out the current bit values as a single integer using the two's complement bit model. It should then prompt the user to either set a bit, clear a bit, or exit. If the user desires to set a bit or clear a bit, then the program should prompt the user for which bit, change the appropriate value, and then cycle back to the beginning of the loop. Setting a bit changes its value to 1 regardless of its current value; clearing a bit changes it's value to 0 regardless of its current value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started