Data Types in C Programming

C Data Type specifies the type of data that we store in a variable. In C programming language, there are many data types and the type of data also specifies how much amount of memory is allocated to a specific variable. Data types are used along with variables and function’s return type.

There are different data types. The main three classifications are :

  1. Primary data types
  2. Derived data types
  3. Enumerated data types

Primary Data Types

Fundamental data types defined in C are called Primary Data Types. They are :

  1. Integer
    1. Signed integer
      1. int
      2. Short
      3. long
    2. unsigned integer
      1. Int
      2. Short
      3. long
  2. Float
    1. float
    2. double
    3. long double
  3. Character
    1. signed char
    2. unsigned char
  4. Void


The below given data types will store whole numbers. Whole numbers are 0,1,2,3… Following table shows the ranges for different integer datatypes.

TypeStorage Space in bytesRange of whole numbers that can be storedFormat
Int (or)signed int2-32,768 to 32,767%d
Unsigned int20 to 65,535%u
Short (or) signed short1-128 to 127%d
Unsigned short10 to 255%u
Signed long4-2,147,483,648 to 2,147,483,647%ld
Unsigned long40 to 4,294,967,295%lu

The most important objective of programming  is saving memory to make the program run as fast as possible. To use memory efficiently, C programming has divided the data types as int, short, long, etc.  If you know exactly how big the number is going to be and how often it is going to modified then you can declare the variable as short or int or long, so that you can save as much memory as possible.

Floating point types

Float types are to store decimal point numbers (or) real numbers. Real numbers are for example : 1.00,5.36 etc.

DataTypeStorage space in bytesRangePrecisionFormat
Float43.4E-38 to 3.4E+386 decimal places%f
Double81.7E-308 to 1.7E+30815 decimal places%lf
Long double103.4E-4932 to 1.1E+493219 decimal places%Lf


This datatype is used to store ASCII characters. Examples are a, b, z, 8, $. char is supposed to store characters only not numbers, so why should it holds range?

In the memory characters are stored in their ASCII codes. For example, the character ‘B’ has the ASCII code 66. In the memory ‘B’ will not be stored as ‘B’ but as 66.

We have unsigned char and signed char.We don’t have negative characters, then why should we have such datatypes?

We used signed and unsigned char to ensure portability of programs that store non character data as char.

TypeStorage space in bytesRangeFormat
Char or signed char1-128 to 127%c
Unsigned char10 to 255%c


Void data type variables doesn’t have a value of any type. Void means no value.

Theoretically the void type should use no manipulable memory on stack when defined. That is to say, a variable declared with a “void” type shouldn’t be capable of storing any data, and therefore has a size of zero.

Basically void data type are used in some special places and some of them are following :

  • To specify return type of a function(when function returns no value).
  • To specify the parameters of a function(when the function accepts no argument from the caller)
  • To create generic pointers.

Derived data type:

As the name suggests, derived data types are basically derived from primary data types. They don’t create a new data type but, instead they add some functionality to the basic data types. Derived data types includes arrays, pointers, structures. A pointer is essentially a value which points to another data space. An array is a collection of the same basic types of data that is contiguous in memory.We will have an elaborated discussion on them later.

Enumerated Data Type

Enumerated data type is an user defined data type i.e., user can create their own datatype. “enum” is a key word for defining such. It consists of integral consonants. Enum variable holds only a set of defined values.


enum variablename {value1,value 2……};


In the following example, we have defined two Enums.

enum week{Sunday,Monday,Tuesday,wednesday,Thursday,Friday,Saturday};
enum colors{red,blue,green};


In this C Tutorial, we have learnt different primary data types available, derived data types that could be formed using primary data types and also enumerated data types. In our next tutorial, we shall learn, how to use these data type along with variables in C programs.