Bcaguru

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 :-it is also called Basic Datatypes or Predefined Datatypes.
  2. Derived Datatypes:- It is also known as Secondary Datatypes or Userdefined Datatypes.
  3. Enumeration Datatypes
  4. Void Datatype

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 known as Built-In datatypes. Some  primary datatypes in c programming language are given below:-

  1. Integer Datatype
  2. Floating Point Datatype
  3. Double Datatype
  4. Character Datatype

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:-

Floating Point Datatypes

Floating point datatypes are the set of numbers along with decimal value. It means every floating point value must have the decimal value. There are two variants of floating point datatype…

  • float
  • double

float” keyword is used to represent floating point datatype and “double” keyboard is used  to represent double datatype in c. Both 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.

       à Complete details about floating point datatypes are given below

Character Datatype

Character datatype is a set of characters enclosed in single quotations.

                 The complete information details about character datatypes are given below:-

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

void Datatype

The void datatype means ‘nothing’ or ‘no value’. Generally, void is used to specify a function which never return any value. Void datatype is also used 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

Leave a Reply

Close Menu
error: Content is protected !!