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…
- Primary Datatypes :-it is also called Basic Datatypes or Predefined Datatypes.
- Derived Datatypes:- It is also known as Secondary Datatypes or Userdefined Datatypes.
- Enumeration Datatypes
- Void Datatype
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:-
- Integer Datatype
- Floating Point Datatype
- Double Datatype
- Character 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” 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 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…
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.
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 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…