C language offers 3 different type modifiers-short, int, and long that represents ‘int’ three different integer sizes. C language also offers 3 different floating point type double, and long double. Two special modifiers are-signed, ‘char’type unsigned. Type Size (in bytes) Range Int (signed/short) 2-32768 to 32767 In (unsigned) 2 0 to 65535 Long (signed) 4-2, 147,483,648 to 2, 147, 483, 648 Long (unsigned) 4 0 to 4,294,467,295 10 Second Semester Introduction to Programming, May-June 2013 Float 4 3.4*10-34 to 3.4*10-34 Double (long float) 8 1.7*10-308 to 1.7*10-308-1 Long double 10 3.4*10-4932 to 3.4*10-4932-1 Char 1 to 127 –128 Signed char 1 0 to 255 Unsigned char 1 to 127 –128 2. Derived Data Types Data types that are derived from fundamental data types are called derived data types. Derived data types don’t create a new data type; instead, they add some functionality to the basic data types. Two derived data type are - Array & Pointer. Array An array is a collection of variables of same type i.e., collection of homogeneous data referred by a common name. In memory, array elements are stored in a continuous location. Syntax: [ ]; E.g. int a[10]; char ch [20]; According to the rules of C language, 1st element of array is stored at location a[0], 2nd at a[1] & so on. Pointer A pointer is a special variable that holds a memory address (location in memory) of another variable. E.g. if we want to store the address of an data type variable into a pointer ‘int’ variable, it is done in the following manner: int a, *b; b=&a; In the above case, variable stores the address of variable ‘b’ ‘a’. 3. User Defined Data Type User defined data type is used to create new data types. The new data types formed are fundamental data types. Different user defined data types are; struct, union, enum, typedef. Struct
C language offers 3 different ‘int’ type modifiers-short, int, and long that represents three different integer sizes. C language also offers 3 different floating point type double, and long double. Two special ‘char’type modifiers are-signed, unsigned. Type Size (in bytes) Range Int (signed/short) 2-32768 to 32767 In (unsigned) 2 0 to 65535 Long (signed) 4-2, 147,483,648 to 2, 147, 483, 648 Long (unsigned) 4 0 to 4,294,467,295 10 Second Semester Introduction to Programming, May-June 2013 Float 4 3.4*10-34 to 3.4*10-34 Double (long float) 8 1.7*10-308 to 1.7*10-308-1 Long double 10 3.4*10-4932 to 3.4*10-4932-1 Char 1 –128 to 127 Signed char 1 0 to 255 Unsigned char 1 –128 to 127 2. Derived Data Types Data types that are derived from fundamental data types are called derived data types. Derived data types don’t create a new data type; instead, they add some functionality to the basic data types. Two derived data type are - Array & Pointer. Array An array is a collection of variables of same type i.e., collection of homogeneous data referred by a common name. In memory, array elements are stored in a continuous location. Syntax: [ ]; E.g. int a[10]; char ch [20]; According to the rules of C language, 1st element of array is stored at location a[0], 2nd at a[1] & so on. Pointer A pointer is a special variable that holds a memory address (location in memory) of another variable. E.g. if we want to store the address of an ‘int’ data type variable into a pointer variable, it is done in the following manner: int a, *b; b=&a; In the above case, variable ‘b’ stores the address of variable ‘a’. 3. User Defined Data Type User defined data type is used to create new data types. The new data types formed are fundamental data types. Different user defined data types are; struct, union, enum, typedef. Struct
ITP%20Model%20Test%20paper.docx