Data Type in C
Data Type: C language is reach in its data type. Data type are use to present the type of the value that can be represented by variable. They also specify the memory size required for the data value.
Data type is refer for computer memory representations for store value depending upon data structure in this is structure they occupied memory size in bytes in that storage they stored value in specific range.
C language having a large set of data type are classifies as follows:
Data Type: C language is reach in its data type. Data type are use to present the type of the value that can be represented by variable. They also specify the memory size required for the data value.
Data type is refer for computer memory representations for store value depending upon data structure in this is structure they occupied memory size in bytes in that storage they stored value in specific range.
C language having a large set of data type are classifies as follows:
- Primary\Fundamental\Basic\predefined\primitive\ data type
- User defined data type(Non-Primitive)
- Derived data type
- Empty data type
Basic Data Type
Basic Data Type: The primary data type storage representation and machine instruction to handle constant differ from machine to machine. C compiler Supports Four basic data type namely char, int, float, double.
Integer Type: Integers are whole number with a machine dependent range of values. Following table shows that the data-type, its size and range of values.
Floating Point Type: Floating point number represents real numbers. Following are the types of floating point number its size and range.
Character Type: A single character can be defined as a character type of data. Character are usually stored in 8 bits of internal storage. The following table shows range of values.
User-defined Data Types
User-defined Data Type: It is a user-defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class. A class is like a blueprint for an object. Structure: A structure is a user defined data type in C/C+
Typedef (Type of definition): C supports a features known as type definition, that allows user to define as identifier that put on existing data-type. User-defined data-type identifier can use for later. Following is the syntax for creating user-defined data-type.
Syntax:-
e.g
typedef unsigned long int INT ;
INT a;
typedef double real ;
real x,y,z
Enum(Enumeration): The identifier is user-defined data-type and enumerated we can used to declare variable that can have one of the value enclosed within the braces known as enumerated (List of values). Following syntax for creating enum data-type.
Syntax:-
e.g
Syntax:-
typedef data_type identifier ;Here data-type refers to an existing data-type and identifier refers to a new name given to the existing data-type. The data-type cannot create a new data-type a permanent use but we can use inside the program where it is defined.
e.g
typedef unsigned long int INT ;
INT a;
typedef double real ;
real x,y,z
Enum(Enumeration): The identifier is user-defined data-type and enumerated we can used to declare variable that can have one of the value enclosed within the braces known as enumerated (List of values). Following syntax for creating enum data-type.
Syntax:-
enum identifier {value1, value2,.....,value n}In the above syntax identifier is a name that is for user defined data-type enum for enumeration (List of values) that any one value will stored on a variable of type identifier i.e enum.
e.g
enum weekdays{sun, Mon, Tue, Wed, Thu, Fri, Sat}
Post a Comment