Q:

C Program to swap two words/bytes

0

C Program to swap two words/bytes

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include <stdio.h>
 
int main()
{
    unsigned int data=0x1234;
    printf("\ndata before swapping : %04X",data);
 
    data= ((data<<8)&0xff00)|((data>>8)&0x00ff);
 
    printf("\ndata after swapping  : %04X",data);
 
    return 0;
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now