C- Data type
Data type is an instruction that is used to declare the category or type variable being used in the program. Any variable used in the program must be declared before using it. It determines how much money space it occupies in the storage and how the bit pattern stored is interpreted. the data type can be either predefined or derived.
The predefined data types in C are the basic types (int, float and char) and the type void. the derived data types are array, string, structure etc.
1. int data type
The int data type is used for integers. Integers are numbers with no decimal point. It requires 2 Bytes of memory space. it can be either signed or unsigned. Derived data types from int are short int and long int. For example : 24, -90, 1234, 0 etc.2. float data type
This data type is used for numbers that have a decimal point which are commonly called floating-point numbers. It requires 4 Bytes of memory space. It can also be signed or unsigned. Derived data types from float are double and long double. For example: 76.45, 12.4, -90.6 etc.3. char data type
This data type is used for characters. It can be used for any valid character in C++ and not just alphabets. It requires 1 Bytes of memory space. It can also be either signed or unsigned.Here is a special thing about this data type: characters are stored in memory using their ASCII codes which are numeric i.e. integers. Thus, char type is basically the same as int data type.
4. void data type:
The word void means empty. So it has no value. This is used as return type for functions that do not return a value.Click on The question related to C programming language:
0 Comments