Data Types in C

A data type specifies the type of data or value that a variable can store such as integer, floating, character, double, etc.

Data types in C

There are four types of data type in C language:

  1. Basic Data Type – int, char, float, double
  2. Derived Data Type – array, pointer, structure, union
  3. Enumeration Data Type – enum
  4. Void Data Type – void

The basic data types are integer-based and floating-point based. C language supports signed and unsigned both literals.

The size of the memory of the basic data types can vary on different bits of the operating system. The size of the memory of data types will be different for 16-bit, 32-bit, and 64-bit operating systems.

The following data type’s size is presented according to the 32-bit operating system:

Data TypesMemory SizeRange
char1 byte-128 to 127
signed char1 byte-128 to 127
unsigned char1 byte0 to 255
short2 bytes-32,768 to 32,767
signed short2 bytes-32,768 to 32,767
unsigned short2 bytes0 to 65,535
int2 bytes-32,768 to 32,767
signed int2 bytes-32,768 to 32,767
unsigned int2 bytes0 to 65,535
short int2 bytes-32,768 to 32,767
signed short int2 bytes-32,768 to 32,767
unsigned short int2 bytes0 to 65,535
long int4 bytes-2,147,483,648 to 2,147,483,647
signed long int4 bytes-2,147,483,648 to 2,147,483,647
unsigned long int4 bytes0 to 4,294,967,295
float4 bytes
double8 bytes
long double10 bytes

Note: for 64-bit memory size will be 2x.

Leave a Comment

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

Scroll to Top