online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/* --- PRINTF_BYTE_TO_BINARY macro's --- */ #define BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(i) \ (((i) & 0x80) ? '1' : '0'), \ (((i) & 0x40) ? '1' : '0'), \ (((i) & 0x20) ? '1' : '0'), \ (((i) & 0x10) ? '1' : '0'), \ (((i) & 0x08) ? '1' : '0'), \ (((i) & 0x04) ? '1' : '0'), \ (((i) & 0x02) ? '1' : '0'), \ (((i) & 0x01) ? '1' : '0') /* --- end macros --- */ #include <stdio.h> int main() { // Bit positions // 76543210 int val_a = 0b00101101; int val_b = 0b00001000; int val_x = val_a | val_b; printf("input A: " BINARY_PATTERN "\n", BYTE_TO_BINARY(val_a)); printf("input B: " BINARY_PATTERN "\n", BYTE_TO_BINARY(val_b)); printf("result A|B: " BINARY_PATTERN "\n", BYTE_TO_BINARY(val_x)); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue