Set and Clear GPIO Bits

Easy C IO Asked at Texas Instruments
Solve this problem

You are given an 8-bit GPIO register value.

Write a function that: 1) Sets bit 3 2) Clears bit 6 3) Returns the modified register value

This simulates low-level GPIO register manipulation in embedded firmware.

Input: An 8-bit value representing a GPIO register. Output: The modified 8-bit value.

Constraints

  • Do not use loops.
  • Use bitwise operations only.
  • Treat input as unsigned 8-bit.
Starter codeC
1unsigned char modify_gpio(unsigned char reg) {2    // Set bit 3 and clear bit 63    return 0;4}