linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* union to get parts of integer
@ 2010-12-20 10:40 ratheesh k
  2010-12-20 12:03 ` Reza Hoorfar
  2010-12-20 14:44 ` Michal Nazarewicz
  0 siblings, 2 replies; 6+ messages in thread
From: ratheesh k @ 2010-12-20 10:40 UTC (permalink / raw)
  To: linux-c-programming

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-21 16:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-20 10:40 union to get parts of integer ratheesh k
2010-12-20 12:03 ` Reza Hoorfar
2010-12-20 14:44 ` Michal Nazarewicz
2010-12-20 15:30   ` Tim Walberg
2010-12-20 15:40     ` Michal Nazarewicz
2010-12-21 16:22     ` Glynn Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).