Page 1 :
Data Types in C:Most of the time in calculation, data is used for example in finding the sum of two, numbers. First of all these two numbers need to be stored in computer memory, then the result obtained after adding these two numbers is again stored in the, memory. Now a question arises what size of memory should be used for storing, these numbers? To answer this question one needs to know what the type of, number is .A number might be an integer (whole number such as 20) or real, number (floating point number such as 10.25). An integer needs 2 bytes for, storage. One byte equals eight bits., , Data types in C Language, Data types specify how we enter data into our programs and what type of data, we enter. C language has some predefined set of data types to handle various, kinds of data that we can use in our program. These datatypes have different, storage capacities., , C language supports 2 different types of data types:, Primary data types:, These are fundamental data types in C namely integer (int), floating point (float),, character (char) and void., , Derived data types:, Derived data types are nothing but primary data types but a little twisted or, grouped together like array, structure, union and pointers. These are discussed in, details later., Data type determines the type of data a variable will hold. If a variable x is, declared as int. it means x can hold only integer values. Every variable which is, used in the program must be declared as what data-type it is.
Page 2 :
Integer type, Integers are used to store whole numbers., Size and range of Integer type on 16-bit machine:, , Type, , Size, (bytes), , Range, , int or signed int, , 2, , -32,768 to 32767, , unsigned int, , 2, , 0 to 65535, , short int or signed short int, , 1, , -128 to 127, , unsigned short int, , 1, , 0 to 255, , long int or signed long int, , 4, , -2,147,483,648 to, 2,147,483,647, , unsigned long int, , 4, , 0 to 4,294,967,295
Page 3 :
Floating point type, Floating types are used to store real numbers., Size and range of Float type on 16-bit machine, , Type, Float, double, long double, , Size(bytes), 4, 8, 10, , Range, 3.4E-38 to 3.4E+38, 1.7E-308 to 1.7E+308, 3.4E-4932 to 1.1E+4932, , Character type, Character types are used to store characters value., Size and range of Character type on 16-bit machine, , Type, char or signed char, unsigned char, , Size(bytes), 1, 1, , Range, -128 to 127, 0 to 255, , void type, void type means no value. This is usually used to specify the type of functions, which returns nothing. We will get acquainted to this datatype as we start learning, more advanced topics in C language, like functions, pointers etc.