Microcontroller Embedded C Programming Lecture 28| Integer data type ‘int’ and ‘long’

  • Post author:
  • Post category:Blog

 

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

 

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.

Leave a Reply