Question: Please fill in this function: int isBitSet(unsigned char c, int bitNum) { } 1. Determine whether a bit is set to 1 Write a function

Please fill in this function:
int isBitSet(unsigned char c, int bitNum)
{
}
1. Determine whether a bit is set to 1 Write a function that accepts as input an unsigned char, and an integer bitNum (range 0-7) and using the "shift" and "and" operators returns a 1 if bit bitNum is set (bit bitNum is 1) and 0 otherwise. For example, if the bit sequence of a char is 00010100 and bitNum4 then the answer should return 1 Function prototype int isBitSet(unsigned char c, int bitNum); Instructions Steps: 1. Creating a mask - in order to accomplish this you need to expose the required bit. This is done using the "left shift" operator on the number 1 (the integer 1 has a bit representation of 000e0001, which is a 1 in bit e) For example, to create a mask that exposes the bit at position 1 (the second bit from the right) one case use 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
