Hi,
Can we write a program like this
void main(void)
{
int a=20;
printf("%dn",a);
a= (a<<8) | (a>>8);
printf("%dn",a);
}
Login to rate this answer.
BIJOYA
Answered On : Sep 13th, 2006
Better will be no = ( ( no & 0xff ) << 8) | ( no >> 8 )
Login to rate this answer.
Anand Krishnan
Answered On : Oct 24th, 2006
i think we can use this code in function
int i=52;
asm{
rol i,8
}
Login to rate this answer.
NHKR
Answered On : Oct 30th, 2006
void swaploworder(){ unsigned int r=20; unsigned short *p; printf("Inside swaplowordern"); printf("the size of short is %dn",sizeof(short)); p=(short*)&r; printf("The value of r is %dn",r); printf("The value at upper half is %dn",*p); printf("The value at lower half is %dn",*(p+1)); *p=*p+*(p+1); *(p+1)=*p-*(p+1); *p=*p-*(p+1); printf("The value at upper half is %dn",*p); printf("The value at lower half is %dn",*(p+1)); printf("the new value of r is %dn",r);}
Login to rate this answer.
Arup Ratan Banerjee
Answered On : Jan 29th, 2007
1) int x=5; int y =100; x=x ^ y; y=y^x; x=x^y; printf("%d , %d ", x,y);2) int x=5; int y=100; x=y-x; y=y-x; x=y+x; printf("%d , %d", x,y);
Login to rate this answer.