Data Types in C: Primitive Data Types in C Language

Data types in C programming language enables the programmers to appropriately select the data as per requirements of the program and the associated operations of handling it.

Data types in c language can be broadly classified as:

  1. Primitive Data Types
  2. User Defined Data Types, for example, enum, structure, union
  3. Derived Data Types, for example, array, pointers

In this tutorial we will only focus on primitive data types, user defined and derived data types will be discussed separately.

Primitive Data Types

The primitive data types in c language are the inbuilt data types provided by the c language itself. Thus, all c compilers provide support for these data types.

The following primitive data types in c are available:

Integer Data Type, int

Integer data type is used to declare a variable that can store numbers without a decimal. The keyword used to declare a variable of integer type is “int”. Thus, to declare integer data type following syntax should be followed:

int variable_name;

Float data Type, float

Float data type declares a variable that can store numbers containing a decimal number.

Syntax

float variable_name;

Double Data Type, double

Double data type also declares variable that can store floating point numbers but gives precision double than that provided by float data type. Thus, double data type are also referred to as double precision data type.

Syntax

double variable_name;

Character Data Type, char

Character data type declares a variable that can store a character constant. Thus, the variables declared as char data type can only store one single character.

Syntax

char variable_name;

Void Data Type, void

Unlike other primitive data types in c, void data type does not create any variable but returns an empty set of values. Thus, we can say that it stores null.

Syntax

void variable_name;

Data Type Qualifiers

Apart from the primitive data types mentioned above, there are certain data type qualifiers that can be applied to them in order to alter their range and storage space and thus, fit in various situations as per the requirement.

The data type qualifiers available in c are:

  • short
  • long
  • signed
  • unsigned

It should be noted that the above qualifiers cannot be applied to float and can only be applied to integer and character data types.

The entire list of data types in c available for use is given below:

C Data Types Size(in bytes) Range
Integer Data Types int

signed int

unsigned int

short int

signed short int

unsigned short int

long int

signed long int

unsigned long int

2

2

2

1

1

1

4

4

4

-32,768 to 32,767

-32,768 to 32,767

0 to 65535

-128 to 127

-128 to 127

0 to 255

-2,147,483,648 to 2,147,483,647

Same as Above

0 to 4,294,967,295

Floating Point Data Types float

double

long double

4

8

10

3.4E-38 to 3.4E+38

1.7E-308 to 1.7E+308

3.4E-4932 to 1.1E+4932

Character Data Types char

signed char

unsigned char

1

1

1

-128 to 127

-128 to 127

0 to 255

One Response

  1. atal awasthi
    atal awasthi September 9, 2013 at 5:49 pm | | Reply

    Good work

Please comment with your real name using good manners.

Leave a Reply