/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <stdio.h>
int binConv(int num)
{
if (num == 0)
{
return 0;
}
else
{
return (num % 2) + 10 * binConv(num / 2);
}
}
int main()
{
unsigned char test1;
unsigned char test2;
test1=0x02;
test2=~(0x02);
printf(" test1: 0x%08x 0b%08u (%d bytes)\n",test1,binConv(test1),sizeof(test1));
printf(" test2: 0x%08x 0b%08u (%d bytes)\n",test2,binConv(test2),sizeof(test2));
printf("~test1: 0x%08x 0b%08u (%d bytes)",~test1,binConv(~test1),sizeof(~test1));
return 0;
}