Integer data type ‘int’ and ‘long’
In this article, let’s understand the integer data types ‘int’ and ‘long.’
Integer data types: int and unsigned int
- int is an integer data type to store signed integer data, just like short int. But the int size is greater than short or it may be equal to short.
- An int type variable consumes 2 bytes of memory or 4 bytes of memory. That depends on the compiler.
- Size of an int is decided by the compiler being used to generate code for your target hardware. i.e., you need to consult the compiler user manual to understand the size of an int. It is typically 2 or 4 bytes.
- unsigned int is an integer data type to store unsigned integer data.
Integer data types: long and unsigned long
- long is an integer data type to store signed integer data.
- A long type variable consumes 4 bytes of memory or 8 bytes of memory. So, that is very important.
- Size of long data type is decided by the compiler being used to generate the code for your target hardware. i.e., you need to consult the compiler user manual to understand the size of long. It is typically 4 or 8 bytes.
- unsigned long is an integer data type to store unsigned integer data.
FastBit Embedded Brain Academy Courses
Click here: https://fastbitlab.com/course1