Question: Please write a function called op_bits that receives 3 arguments: a byte value called reg an integer called bit_pos an integer called op where the

Please write a function called "op_bits" that receives 3 arguments:

  • a byte value called "reg"
  • an integer called "bit_pos"
  • an integer called "op"

where the function will return the "reg" modified with the bit modified at the position "bit_pos" depending on the "op" string, where the following options for op are:

  • "SET": set the bit "bit_pos" of "reg"
  • "CLR": clear the bit "bit_pos" of "reg"
  • "TOG": toggle the bit "bit_pos" of "reg"
  • default: return 0

Write a program that calls this function 4 times (one per option) and prints the result in the screen

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!