Skip to main content

Describe the four basic data types. How could we extend the range of values they represent?


Answer:

The basic four data types are:

Data Type


Integer Type
Character Type
Floating Point Type
Void Type
signed
int
short int
long int
unsigned
unsigned int
unsigned short int
unsigned long int
char
signed char
unsigned char
float
double
long double


                                                



Integer Type:
Integer are whole number with a range of values supported by a particular machine. Integer occupy one word of storage and since the word sizes of machines size of an integer that can be stored depends on the computer.Generally an integer occupies 2 bytes memory space and its value is limited to the range -32768 to +32767.

General form:
int<variable name>;
int num1;
short int num2;
long int num3;
Example:
            450, 45, 45000.




Character Type:
A single character can be defined as a character type data characters are usually stored in 8 bits of internal storage while unsigned chars have values between 0 and 225, signed chars have values from -128 to +127.

General form:
            char<variable name>;
            char ch=’a’;
Example:
            a,b,M,R,m;


Floating Point Type:
Floating point number are stored in 32 bits, with 6 digit of precision. Floating point numbers are denoted by the keyword float. Float number is not sufficient, the type double can be used to define the number. A double data type number uses 64 bits giving a precision of 14 digits. To extend the precision further, we may use long double which uses go bits.
Generally float occupies 4 bytes memory space and its value is limited to the range -3.4e38 to +3.4e38

General form:
            float<variable name>;
            float num1;
            double num2;
            long double num3;
Example:
            450.45, 45.45, 45000.45



Void Type:

The void type has no values. This is usually used to specify the type of function. The type of function. The type of a function is said to be void when it does not return any value. The role of a generic type. 

Popular posts from this blog

Draw the basic organization of computer

Answer:                 The basic organization of computer__ Input Unit: ·          It accepts (or reads) instructions and data from outside. ·          It converts these instructions and data in computer acceptable form ·          It supplies the converted instructions and data to the computer system for further processing. Central Processing Unit (CPU): Control Unit: Control unit of a computer system manages and coordinates the operations of all other components of the computer system. Arithmetic Logic Unit(ALU): Arithmetic logic unit of a computer system is the place, where the actual executions of instruction, takes place during processing operation. Storage Unit: Primary Memory: It is volatile ( loses data on power ...