సమాధానాలు కొన్నిటికి

5.Write a C program to swap successive bits of character?
 #include
#include
void swapBits(unsigned char *val)
{
    unsigned char temp;
    temp = ((*val) & 0xAA);
    *val = ((*val) & 0X55);
    *val <<=1;
    temp >>=1;
    *val |=temp;
}
int main()
{
    unsigned char valTobeSwapped=0xB8;

    swapBits(&valTobeSwapped);

    printf("%x",valTobeSwapped);

    return 0;
}

No comments:

Post a Comment

తెలుగులో వ్రాయడానికి http://www.google.com/ime/transliteration/ ఉపయోగించండి.