I've bee having a problem with my code. I have a structure with a nested union that contains to pointers. I want to read the first 4bytes from a buffer into a the integer pointer from the structure.
This si the code:
Code:
typedef struct s_test{
char m_flag;
union{
char *id;
int *value;
}utest;
}ST;
int main()
{
char test_buffer[]="abcdefghijkl12345678";
ST s_table[100];
int i=0;
s_table.utest.id= test_buffer;
for (i=0; i<3; i++)
{
s_table[i].utest.value=&test_buffer[i]; /* How do i make my structure point to the arra?????*/
printf(" Buffer %08x\n\n", *(s_table.utest.value));
}
return 0;
}
Many thanks.