#include <stdio.h> #include <stdint.h> int toggle_bit(unsigned char reg, int pos) { reg ^= (1<<pos); // Your code here return reg; } int main() { int reg, pos; scanf("%hhu %hhu", ®, &pos); unsigned char result = toggle_bit(reg, pos); printf("%u", result); return 0; }
Test Cases
Test Results
Input
6 1
Expected Output
4