#include int ascii_to_bin_subtraction(char c) { return c - '0'; } int ascii_to_bin_bitwise(char c) { return c & 0x0F; } char bin_to_ascii_addition(int i) { return i + '0'; } char bin_to_ascii_bitwise(int i) { return i | 0b00110000; // or in hex `0x30` } int main(void) { assert(5 == ascii_to_bin_subtraction('5')); assert(5 == ascii_to_bin_bitwise('5')); assert(ascii_to_bin_subtraction('5') == ascii_to_bin_bitwise('5')); assert('5' == bin_to_ascii_addition(5)); assert('5' == bin_to_ascii_bitwise(5)); assert(bin_to_ascii_addition(5) == bin_to_ascii_bitwise(5)); }