Mail Archives: djgpp/1998/07/02/06:40:27
Hi world
I have built the following struct:
struct
{
char one;
short two,three;
long four
} foo;
But when I do sizeof of this struct, the result is wrong (it says the
struct has 12 bytes).
I think gcc tryes to allocate the struct variables in blocks of 4 bytes.
But I have a problem, because I use the following sentence:
memcpy(pointer_to_memory,&foo,sizeof(foo));
And I must to allocate each variable in a memory position of 9 bytes,
when the first byte is one variable, the following two bytes are a short
variable, ...
Does anything have a solution?
Thanks
- Raw text -