Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Program Discussion :: Bitwise Operator

Home > Programs > Bitwise Operator

17 / 15

Write an efficient program to swap the nibbles in a byte

Answer:

#include 
#include
using namespace std;
/* function : swapTwoNibbles, to swap two nibbles of a given byte.*/
unsigned char swapTwoNibbles(unsigned char n)
{
    unsigned char num;
    num= ( (n & 0x0F)4 );
    return num;

int main()
{
    unsigned char number;
    unsigned char revNumber;
      coutnumber;
    revNumber=swapTwoNibbles(number);
    cout

Asked In ::

Post Your Answer Here:

Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here:



Language:

Post Your Reply Here: