Pages

Saturday, April 24, 2010

combine 2, 32 bit no to create 64 bit no C

#define shift(val)val=val<<32
#define concat(val,num2)val=val|num2
#define call(val,num2) shift(val);concat(val,num2)
int main()
{
int num1;
int num2;
unsigned long long val;

scanf("%d",&num1);
scanf("%d",&num2);
val=(long long)num1;
call(val,num2);
printf("%lld",val);

}

No comments:

Post a Comment