![]() In case of short int, it is typically 2 bytes and in long int, it is 4 bytes SIGNED AND UNSIGNED These are used to define the amount of memory space that the compiler will allocate. Now these are further classified as short, long,double, long double, signed and unsigned data types in C.īefore discussing this, let us first understand what short, long, signed and unsigned data types in C means. It contains integer, floating point and char.įour main types of primary/basic data types are: These are the most basic data types and all the other data typed are derived or made from them only. It can be of type integer, float( decimal), character, boolean( true/false ) etc.įormally we use data types to specify the type of data our variables are holding.īroadly there are two types of data types in C:Ī. What are data types in Cĭata type is an attribute of data which tells the compiler, which type of data a variable is holding. To deal with such scenarios we assign data types to each variable to prevent any confusion or memory wastage. The age consists of the utmost 2 to 3 digits and the phone number consists of at least 10 digits, but computers will assign the same memory to both of them that will lead to a lot of memory wastage. Without mentioning the data types, your computer would not be able to distinguish between your name, age and phone number and will treat them equally by assigning the same memory and keeping them in the same set of variables. Now suppose you want to make a program to store your name, age and phone number. We know that computers store all the data in the form of binary numbers and it assigns memory to each of them. We will also understand and learn how we can code our own secondary data types.We will look at all the different types of primary data-types and the range of data they can store.We will understand different categorization of data types on different levels.In this article we will look at why wee need data types.They are needed to store different types of data like integer, characters, decimals, strings or even user defined. Data types in C (or in any programming language), is very important to learn and understand before you start to write a program. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |