[A89] Re: Char vs. Int


[Prev][Next][Index][Thread]

[A89] Re: Char vs. Int






On Mon, 19 Mar 2001, Matthew Landry wrote:

>
> Is it just me or does int take up less mem than char in ti-gcc?

It's just you.  An int takes 2 bytes of memory, but a char takes only 1.
Of course, if you have a long string of characters, then it will be longer
than a single int.  Also, if you use a structure like

struct abc {
   char x;
   int y;
};

then the char will seem to take up 2 bytes, because the int must be at an
even address, and thus one byte of unused space needs to be inserted in
between.





References: