You have integers in 8, 16, 32 and 64 bits, both signed and unsigned. You have float and double, which can be the same thing on some systems.
There are many names given to those variable types, some standard or ubiquitous, some vague or unique, or change depending on which type of CPU you are working with.
The names aren't important, since they only exist in the source code. All that matters is the underlying size. Names of the same underlying size and signedness are interchangeable at will.
- uint8_t = unsigned char
- int32_t = long = int on 32 but systems
- uint16_t = unsigned short = int on 8 bit systems
As you can see
int changes depending on the system you are on. So it is best to stick to specifically named types. I always use the
So you have:
- double (if the compiler supports double on the platform you are compiling for, otherwise it is just float).
Arduino itself provides some more unique variable names that are completely nonstandard, such as
short (pun intended), stick to variables that specifically define their type if you are worried about how big they all are, and avoid all the rest.
For overloading the compiler will automatically "upscale" the variables to the best fitting available function (known as type promotion) unless functions are flagged as
explicit, so you can have a function with a
long parameter and pass any integer variable up to and including a
long in size. The same with
double types - if your function takes a
double you can pass it a
float. Useful when you don't know if the target provides a real
double or not - just use
double and it will work regardless with either