-
union
I am not getting this code.
Code:
#include <stdio.h>
#include <stdlib.h>
int main ( void )
{
union{
struct{
char a;
char b;
char c;
char d;
} car;
struct{
int i;
int j;
}in;
long z;
}pqr;
pqr.car.a=3;
pqr.car.b=2;
pqr.car.c=1;
pqr.car.d=0;
printf("%d...%d...%ld",pqr.in.i,pqr.in.j,pqr.z);
return EXIT_SUCCESS;
}
output
---------
66051...-370086...66051
-
what specifically don't you get? You have to actually ask a question to get any answers.
-
Print them out using
%04x for the int, and %08x for the long
Oh, this code assumes 2-byte ints