Here is the sample code
int main(void) {
int x = 0x1234abcd;
int y = 0x5678cdef;
long long z = ((long long)x<<32) | y;/* x needs to be type casted as long long */
printf("%llx\n",z);
return 0;
}
Also take consideration of x
or y
being negative number i.e if sign
bit is set(1)
. It’s better to declare type as unsigned
as pointed by @harold.
5
solved concatenate two integers in hexa and save them in long long int C