Introduction to Primitive Data Types

In this tutorial, we will learn about the basic types of data that the C programming language offers.


Classification of Primitive Data Types

C has 5 primary data types:

  1. int
  2. float
  3. double
  4. char
  5. void

We will explore each of these data types in more depth shortly. However, before that, let’s take a brief overview of how these data types are categorized and the specific format they use to represent values and their range.

Classification of Primitive Data Types
Data TypesMemory RequirementsFormat SpecifierRange
short int2 bytes = 16 bits%hd-32768 to +32767
int4 bytes = 32 bits%d-2147483648 to +2147483647
long int4 bytes = 32 bits%ld-2147483648 to +2147483647
long long int8 bytes = 64 bits%lld-9223372036854775808 to +9223372036854775807
unsigned short int2 bytes = 16 bits%hu0 to 65535
unsigned int4 bytes = 32 bits%u0 to 4294967295
unsigned long int4 bytes = 32 bits%lu0 to 4294967295
unsigned long long int8 bytes = 64 bits%llu0 to 18446744073709551616
signed char1 byte = 8 bits%c-128 to +127
unsigned char1 byte = 8 bits%c0 to 255
float4 bytes = 32 bits%f1.2E-38 to 3.4E+38
double8 bytes = 64 bits%lf1.7E-308 to 1.7E+308
long double16 bytes = 128 bits%Lf3.4E-4932 to 1.1E+4932

Now, let’s delve deeper into each of these data types and understand them better. We will also explore how to calculate the ranges as mentioned in the above table.



Leave a comment

Leave a comment

Your email address will not be published. Required fields are marked *

Thank you for choosing to leave a comment. Please be aware that all comments are moderated in accordance with our policy. For more information, please review our comments policy. Rest assured that your email address will not be shared with anyone. Kindly refrain from using keywords in your comment. Let’s maintain a respectful atmosphere and engage in meaningful conversations.