Write a simple bit manipulation code that allows users to indicate decimal number and bit system

Computer Science Question

Bit Level Manipulation

Write a simple bit manipulation code that allows users to indicate decimal number and bit system (i.g 4/8/16/32/64) in which binary number will be outputted. Apart from that you have to calculate the corresponding one’s and two’s complement of the decimal number. However, the only named variables you may use are pointer variables; all others must be anonymous variables.

Pay close attention to the following aspects:

  • error checking
  • loop function
  • pointer variables
  • code efficiency(smart code), readability, documentation.