Hi guys,
I have a hex number say 0x4C. What I have to do in C programming for 0x4C to split into two hex number 0x84 and 0x8C?
Hi guys,
I have a hex number say 0x4C. What I have to do in C programming for 0x4C to split into two hex number 0x84 and 0x8C?
Well can you use bit manipulation to get to 0x04 and 0x0C for example?
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Besides trying it out by using a calculator or writing a program, how do you know?Originally Posted by ahgan84
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
As well as &, do you know about >>
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Code:prompt% cat x.c ; gcc x.c -o a.out ; ./a.out #include <stdio.h> int main(int argc, char **argv, char **enver) { unsigned long x = 0x4C; unsigned long a = x ^ 0xC8; unsigned long b = x ^ 0xC0; printf("%lX %lX %lX\n", x, a, b); return(0); } 4C 84 8C prompt%