Data type sizes

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone know where I can find a reference for the data sizes of different data types? I am talking about using the GCC compiler to generate the binary. I know that a char is probably 8 bits. But how big is an int, or a long, short, double etc. I would really like to have a reference I can cite. Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

take a look at this link
http://www.nongnu.org/avr-libc/u...

change without any change is no change ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for the link but I have looked through this page and not found what I am looking for. Basically I would like to know how many bytes are used to represent an Int, a Char and a Float. Also is there such a thing as a short in the AVR world or does it just compile to an int?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

char 1 byte
int 2 bytes
short 2 bytes
long 4 bytes
long long 8 bytes
float 4 bytes
double 4 bytes

But when in doubt, you can just use sizeof().

Edit: You can also use the newer specifications such as int8_t, int16_t, etc.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

its is available there under what registers are used by my c compiler sorry i should have told u that

change without any change is no change ;-)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Steve, Thanks That is the data I was seeking.

Pradheep, yep, there it is. Sorry I did't do a more thorough search. Thanks for your help.