You are here: C/datatypes

C Data Types

A data type is a set of values and is determined to work on those values.
Data types are used for declaring variables or functions of different types in C.
The type of variables determines how much space occupied by variables in memory.
Data types are classified as follows:

  1. Primary data type
    -Character (char)
    -Integer (int)
  2. Secondary data type
    -Enum and etc.

Integer Types

TypeStorage sizeValue range
char 1 byte -128 to 127 or 0 to 255
unsigned char 1 byte 0 to 255
signed char 1 byte -128 to 127
int 2 or 4 bytes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
unsigned int 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295
short 2 bytes -32,768 to 32,767
unsigned short 2 bytes 0 to 65,535
long 4 bytes -2,147,483,648 to 2,147,483,647
unsigned long 4 bytes 0 to 4,294,967,295

Floating Types

TypeStorage sizeValue rangePrecision
float 4 byte 1.2E-38 to 3.4E+38 6 decimal places
double 8 byte 2.3E-308 to 1.7E+308 15 decimal places
long double 10 byte 3.4E-4932 to 1.1E+4932 19 decimal places

sizeof operator

We can use sizeof operator for determining the size of variables on a particular system.


#include <stdio.h>
#include <limits.h>
void main() {
printf("Storage size for int : %d \n", sizeof(int));



Storage size for int : 4 (on LINUX operating system)

Another classification of data types as follows:

  1. Fundamental data types
    - void (denote the type with no values)
    - int (denote an integer type)
    - char (denote a character type)
    - float,double (denote a floating point type)
    - int*,float*,char* (denote a pointer type)
  2. Derived data types
    - array (collection of same data types)
    - string (collection of character variables)
    - structure (collection of same and/or different data types)


Active User (0)

No Active User!
 Log In to Chat