What is C language data type

Programming

C language data type refers to storage capacity, range, and types of information.

Types of C language data type

It divide into four category.

  • Primary data type
  • Derived data type
  • Void data type
  • User-defined data type
c language data type

primary data type:

A data type which provide by the C library is known as a primary data type. it is also known as a built-in or basic data type it derived into three categories such as integer, character, floating-point data type.

integer type:

A data type which can hold only numeric or decimal value without precision point. it is known as integer data type.

There are three types of integer data types such as integer, short integers, and a long integer.

Integer data type

integer: in 16-bit machine, it has the capacity to 2 bites of memory or 16 bit of memory. the range between -32768 to 32767.

It has a signed integer and unsigned integer but default is signed integer.

signed integer can hold positive as well as the negative value where on signed integer can hold only positive value and range is between 0 to 65535.

short integer: in a 16-bit machine, its capacity is 1 by or 8 bit of memory range is between -128 to 127.

It also has signed short integer and unsigned short integer.

unsigned short integer range between 0 to 255.

long integer: as per 16 bit system it required 4 bite or 32 bit of memory range is between -2,14,74,83,648 to 2,14,74,83,647.

It also has signed and unsigned long integer unsigned long integer has a capacity from 0 to 4,29,49,67,295.

character data type:

Character data type

character data type can hold alphanumeric or special symbols values.

char keyword is use to define character data type.

It requires one byte of memory or 8 bit of memory ranges between -128 to 127.

To display the character type of information we can use %c.

floating point:

Floating data type

Data type which used to store floating-point type value or precision type value is known as a floating-point data type.

It required 4 bite or 32 bit of memory according to 16 bit machine.

Range of floating data type is between 3.4E-38 to 3.4E+38

%f is required to display the value of floating data type.

float keyword is used to store information of floating data type.

Example:

float x;

x=3.46;

Maximum floating precision is up to 6. up to 6 precision point is the default in C programming language.

double:

This data type is same as a float data type but it extend the storage capacity of the variable it required 8 bytes or 64 bit of memory.

The double keyword is used to define a double data type range is between 1.7E-308 to  1.7E+308.

long double:

This data type is biggest data type in C programming language.

It required 10 bytes or 80 bits of storage capacity.

The long double keyword is required to store information of long double data type range is between 3.4E-4932 to 3.4E+4932.

void data type:

void means nothing to return generally used in function.