Question: 2. (5 points) Complete a C function below which checks if the n-th bit is 1 in the binary representation of a 64-bit number
2. (5 points) Complete a C function below which checks if the n-th bit is 1 in the binary representation of a 64-bit number (size_t data type on a 64-bit machine) The function returns 1 if the n-th bit is 1 in the number and 0 otherwise. The argument specifying the n-th bit named nbit below ranges from 0 to 62. Hint: it is likely one line of code. Explain your intuition in 2 sentences. The datatype size_t is an unsigned 64-bit integer on 64-bit machines. int check_bit (size_t number, int nbit) { } int condition = return condition;
Step by Step Solution
3.50 Rating (150 Votes )
There are 3 Steps involved in it
Here is the completed C function that checks if the nth bit is 1 in the bin... View full answer
Get step-by-step solutions from verified subject matter experts
