This code may help you to understand what is happening:
union a {
int x;
char j;
char k;
}ua;
int main(){
ua.x = 0xabcd;
printf("%x\n",ua.x); // Print x as hexadecimal: abcd
printf("%x\n",ua.j); // Print j as hexadecimal: ffffffcd
printf("%x\n",ua.k); // Print k as hexadecimal: ffffffcd
printf("%d\n",ua.x); // Print x as decimal: 43981
printf("%c\n",ua.j); // Print j as char: �
printf("%c\n",ua.k); // Print k as char: �
}
When writting 0xabcd into an int, the memory space for the int is filled with this hexadecimal number (abcd) which value in decimal is 43981. You can print both values with %x and %d respectively.
As @Jonathan Leffler said, j and k are just different names that refer to the same byte of the union. This is why the %x prints a value finished in "cd" (the last byte of the value written, due to your system seems to use big endianness) in both cases. The "char value" is represented as � .
If you want to know why there is printed ffffff before the value, check: Printing hexadecimal characters in C.