union to get parts of integer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



typedef struct {
char parts[4];
} node ;

int i=0x12345678

((node *)&i)->parts[0];
((node *)&i)->parts[1];
((node *)&i)->parts[2];
((node *)&i)->parts[3];

Is there any mechanism to split into bytes using the power of union ?

-Ratheesh
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux