The perfect place for easy learning...

C Programming Language

×

Topics List

Place your ad here

C Datatypes

Data used in c program is classified into different types based on its properties. In c programming langauge, datatype can be defined as a set of values with similar characteristics. All the values in a datatype have the same properties.

Datatypes in c programming language are used to specify what kind of value can be stored in a variable. The memory size and type of value of a variable are determined by varible datatype. In a c program, each variable or constant or array must have a datatype and this datatype specifies how much memory is to be allocated and what type of values are to be stored in that variable or constant or array. The formal definition of datatype is as follows...

Datatype is a set of value with predefined characteristics. Datatypes are used to declare variable, constants, arrays, pointers and functions.

In c programming language, datatypes are classified as follows...

  1. Primary Datatypes (Basic Datatypes OR Predefined Datatypes)
  2. Derived Datatypes (Secondary Datatypes OR Userdefined Datatypes)
  3. Enumeration Datatypes
  4. Void Datatype
datatypes in c

Primary Datatypes

The primary datatypes in C programming language are the basic datatypes. All the primary datatypes are already defined in the system. Primary datatypes are also called as Built-In datatypes. The following are the primary datatypes in c programming lanuage...

  1. Integer Datatype
  2. Floating Point Datatype
  3. Double Datatype
  4. Character Datatype
primary datatypes in c

Integer Datatype

Integer datatype is a set of whole numbers. Every integer value does not have the decimal value. We use the keyword "int" to represent integer datatype in c. We use the keyword int to declare the variables and to specify return type of a function. The integer datatype is used with different type modifiers like short, long, signed and unsigned. The following table provides complete details about integer datatype.

integer datatype in c

Floating Point Datatypes

Floating point datatypes are set of numbers with decimal value. Every floating point value must contain the decimal value. The floating point datatype has two variants...

  • float
  • double

We use the keyword "float" to represent floating point datatype and "double" to represent double datatype in c. Both float and double are similar but they differ in number of decimal places. The float value contains 6 decimal places whereas double value contains 15 or 19 decimal places. The following table provides complete details about floating point datatypes.

floating point datatype in c

Character Datatype

Character datatype is a set of characters enclosed in single quotations. The following table provides complete details about character datatype.

character datatype in c

The following table provides complete information about all the datatypes in c programming language...

datatypes in c

void Datatype

The void datatype means nothing or no value. Generally, void is used to specify a function which does not return any value. We also use the void datatype to specify empty parameters of a function.

Enumerated Datatype

An enumerated datatype is a user-defined data type that consists of integer constants and each integer constant is given a name. The keyword "enum" is used to define enumerated datatype.

Derived Datatypes

Derived datatypes are user-defined data types. The derived datatypes are also called as user defined datatypes or secondary datatypes. In c programming language, the derived datatypes are created using the following concepts...

  • Arrays
  • Structures
  • Unions
  • Enumeration

Place your ad here
Place your ad here