This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

how would be a char / short variable stored?

If I've got a struct like:

struct mystruct {
unsigned char   first;
unsigned short  second;
};

How would this be stored in the memory if I'm working with a 32Bit ARM7 microcontroller (SAM serie from ATMEL)? for example first=1 and second=2 in decimal.

When I look into the memory window would it looks like
0x20000000 01 00 00 00
0x20000004 10 00 00 00

(so that a char variable needs the same space like a int variable)

0x20000000 01 10 00 00
(or does it looks like that one)? So that the char variable only needs two bytes and the short variable gets the rest of the 8 bytes?

best regards and thanks for your replies
Mark

0