Home > Article > Backend Development > Write a C program to display ranges of all data types in tabular form
The different data types we use in C programming include integers, shorts, signed and unsigned characters, etc.
Data type specifies the collection of values and the data type that can be stored in a variable. They allow the programmer to choose the type that suits the application's needs.
The data types are as follows-
Let us understand the main type of data.
' The C' compiler supports four basic data types. They are mentioned below -
The integer data type is used to store integers and characters. It is further divided into -
This data type is used to store integers. It has three types of integer storage, namely short, integer and long in signed and unsigned forms.
Range | |||
---|---|---|---|
Short (or) signed short | 1 | -128 to 127 | |
Unsigned short | 1 | 0 to 255 | td> | %uh
int (or) signed integer | 4 | -32768 to 32767 | %d or %i |
Unsigned integer | 4 | 0 to 65535 | % u |
Long (or) signed long | 4 | -2147483648 to 2147483647 | % d |
Unsigned long integer | 4 | 0 to 4294967295 | %lu |
Character data type | This data type is used to store characters. These characters are stored internally as integers. Each character has an equivalent ASCII value | For example: the ASCII value of 'A' is 65 |
Range | |||
---|---|---|---|
th> | Char (or) Signature Char | 1 | - 128 to 127 |
Unsigned character | 1 | 0 to 255 | %c |
Floating point data type | is used to store real numbers (that is, decimal point numbers). | For 6 digits of precision, use "float". |
Range | |||
---|---|---|---|
##Floating point | 4 | 3.4E - 38 to 3.4 E 38 | |
Double | 8 | 1.7 E - 308 to 1.7 E 308 | %lf |
Long double | 16 | 3.4 E - 4932 to 1.1 E 4932 | %Lf |
Example | The following are the supported | main data types - | Live demonstration |
DATA TYPE RANGE ----------- --------- short min -32768 short max int 32767 int min -2147483648 int max 2147483647 Char min -128 Char max 127 long min -2147483648 long max 2147483647 unsigned char 255 unsigned long 4294967295 unsigned int 4294967295 unsigned short 65535
The above is the detailed content of Write a C program to display ranges of all data types in tabular form. For more information, please follow other related articles on the PHP Chinese website!