#include <stdio.h>
#include <stdint.h>
int main()
{
uint32_t var = 0x12345678;//its 32bits(4bytes) -> hexadecimal 1no = 4bits;
uint32_t rev = 0;
for (int i = 0; i < 8; i++)
{
rev = (rev << 4) | ((var >> (4 * i)) & 0xF);
// 1st pos | 12345678 & 0xF = 0x8
// 2nd pos<< 1 by one | 12345678 >> 4 ;01234567 & 0xF
}
printf("%X", rev);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: