Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Hex to Binary in C


Scar0ptics's Avatar
Member
0 0

You must show your work in binary when you make these calculations. You cannot just run this through a compiler. I mean you can (lol), but it defeats the purpose of the exercise, as you need to understand what's going on in the background. I will post my solution later.

List the output:

int main(int argc, char ** argv){

int x = 0x23; int y = 0x15; x = x << 16; printf(“%x\n”, x); x = (x | y) << 8; printf (“%x\n”,x); printf (“%x\n”, y);

x = 0x12345678; y = 0x55; x = ((x<<8) & (y<<8))>>8; printf(“%x\n”, x);

x = 0x23; y = 0x15;

x = x ^ y; printf(“%d\n”, x); x = y ^ x; printf (“%d\n”,x); y = y ^ x; printf (“%d\n”, y);

}