The perfect place for easy learning...

C Programming Language

×

Topics List

Place your ad here

C data types

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

Data types in the c programming language are used to specify what kind of value can be stored in a variable. The memory size and type of the value of a variable are determined by the variable data type. In a c program, each variable or constant or array must have a data type and this data type 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 a data type is as follows...

The Data type is a set of value with predefined characteristics. data types are used to declare variable, constants, arrays, pointers, and functions.

In the c programming language, data types are classified as follows...

  1. Primary data types (Basic data types OR Predefined data types)
  2. Derived data types (Secondary data types OR User-defined data types)
  3. Enumeration data types
  4. Void data type
data types in c

Primary data types

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

  1. Integer data type
  2. Floating Point data type
  3. Double data type
  4. Character data type
primary data types in c

Integer Data type

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

integer data type in c

Floating Point data types

Floating-point data types are a set of numbers with the decimal value. Every floating-point value must contain the decimal value. The floating-point data type has two variants...

  • float
  • double

We use the keyword "float" to represent floating-point data type and "double" to represent double data type in c. Both float and double are similar but they differ in the 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 data types.

floating point data type in c

Character data type

The character data type is a set of characters enclosed in single quotations. The following table provides complete details about the character data type.

character data type in c

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

data types in c

void data type

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

Enumerated data type

An enumerated data type 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 the enumerated data type.

Derived data types

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

  • Arrays
  • Structures
  • Unions
  • Enumeration

Place your ad here
Place your ad here