union to get parts of integer
ratheesh k <[email protected]> Mon, 20 Dec 2010 16:10:17 +0530
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
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