DATA TYPES:
- Data types indicate what type of value you can store in a variable.
- Data type may be Numeric or Non Numeric in Nature.
In C data types are divided into 3 categories:
- User define data types
- Built-in data types
- Derived data types
BUILT-IN DATA TYPES:
Built-in data types are basic or primitive data types. There are 4 built-in data types in C
- Int
- Float
- Char
- Double
Int:
- This is a keyword used to indicate an Integer number.
- Integer is a sequence of digits without decimal point.
- The range of int depend upon the word length of the computer.
- %d format specifier is used.
-2^(8-1) < integer number < +[2^(8-1)] -1
Float:
Char:
Double:
BLACKSLASH CONSTANTS:
It is also called escape sequences. It consist of two characters in which first character is always backslash(\) and second character can be one of the characters a, f, n, r, t, u, ', ", \ and 0. It is used in output statements.
-128 < integer number < +127
Float:
- This is a keyword used to indicate a floating point number.
- The floating point number is a sequence of digits with decimal point that is real number.
- These numbers may be expressed either in decimal form or scientific notation.
- %f format specifier is used
Char:
- This is a keyword used to indicate the character type data.
- The data may be string or character constant.
- Character constant May be defined as any single character enclosed with in a pair of apostrophes. Ex: 'a'.
- Each character constant associated with an integer value.
- String constant may be defined as a combination of characters placed between double quotes. Ex: "shubham".
- The string constant is terminated by null character.
- %c format specifier is used
Double:
- This is a keyword used to indicate a double precision floating point number.
- It is used whenever more accuracy is required in representing the floating point number.
- It is same as that of float but the number of digits after decimal point is double than that of the float.
- Float stores maximum of 6 digits after decimal point. But double stores 16 digits after decimal point.
BLACKSLASH CONSTANTS:
It is also called escape sequences. It consist of two characters in which first character is always backslash(\) and second character can be one of the characters a, f, n, r, t, u, ', ", \ and 0. It is used in output statements.
Backslash Constant \n \t \v \0 \b \a \f | Meaning New Line Horizontal Tab Vertical Tab Null Character Back Space System alarm Form Feed |
Void:
- Only a single Non specified data type.
- It does not Specify anything.
0 Response to "List of Data Types of C And C++ Language"
Post a Comment