Whenever you create a variable, before that, the compiler tells you what kind of data you store in that variable. This gives the compiler the same memory allot from that of the memory of the computer.If there are no data types in a programming language, then there may be a lot of memory waste. When you need 2 bytes then you can waste 20 bytes. Therefore, for any type of data you can store, the maximum memory limit has already been defined for it.
Also Read
[su_youtube_advanced url=”https://www.youtube.com/watch?v=vSezcOvHIDs”]
[su_posts template=”templates/list-loop.php” posts_per_page=”5″ tax_term=”1834″ order=”desc”]
Data Types In C
- Integer Types
- int
- short int
- long int
- signed int
- unsigned int
- Floating Point Types
- float
- double
- Character Types
- char
Integer Data Type
Integer types are used to store any whole number (without decimal). Integer types are of 5 types. Although they all store whole numbers But they are divided on the basis of memory size and range.
Floating Data Type
Floating point data types have been defined to store decimal numbers. Floating point data types are of 2 types.In Float type you can store up to 7 digits after decimals. Double type can be stored up to 17 digits after decimals.
Char Data Type
Character types are used to store a character. These are divided into 2 categories.
- Char
- Unsigned Char
Void Type
The Void type is used in the situation when you do not have any information about value. It is mostly used with functions.
No comments:
Post a Comment