Hi I'm reading Ivor Horton's Beginning C, Third edition. And it came to Bitwise operations where I didn't quit understand this:
unsigned int original = 0xABC
what does it do, and how??
here is the rest of the source code if you what to have a look.
/* Program 3.10 Exercising bitwise operators */
#include <stdio.h>
void main()
{
unsigned int original = 0xABC;
unsigned int result = 0;
unsigned int mask = 0xF; /* Rightmost four bits */
printf("\n original = %X", original);
/* Insert first digit in result */
result |= original&mask; /* Put right 4 bits from original in result */
/* Get second digit */
original >>= 4; /* Shift original right four positions */
result <<= 4; /* Make room for next digit */
result |= original&mask; /* Put right 4 bits from original in result */
/* Get third digit */
original >>= 4; /* Shift original right four positions */
result <<= 4; /* Make room for next digit */
result |= original&mask; /* Put right 4 bits from original in result */
printf("\t result = %X\n", result);
}
Thank you