Thursday 22 September 2011

Data types


In both the programmin languages, i.e C and C++ we use data types. Data types are the tools to identify the type of data and the operations to which it undergoes. In C and C++, there are two types of data types:
  1. Fundamental datatypes
  2. Derived datatypes
  • Fundamental datatypes:  The datatypes which are known as the root of all datatypes are called fundamental datatypes. There are basically five types of fundamental datatypes which can be listed below as:
    1. int data type : When ever we declare any identifier as int type, it becomes an integer variable. For example: If we declare int value then the identifier or variable vlaue will become an integer type data variables. What does this simply specify ? It specifies that the variable value can now store and reveal only integer values or simply it can operate only on integer values.
    2. char datatype: When ever we use char before any specifier, it becomes character type variable. This can be explained with the help of an example. Suppose: char words, now this variable word will become character type, i.e now it can store and reveal or can operate with all data of character type.
    3. float datatype: This datatype when used before any specifier, converts that specifier into a variable of floating type variables. What does this mean ? This means that now that variable can store and reveal or can operate with numerical values that contains digits after decimal.
    4. double datatype: This datatype works similar to float datatype. The only difference is that it can deal with numbers having more places after decimal with minimum chances of error.
    5. void datatype: Void datatype is simple datatype that is used to make any varialbe(mostly functions) which do not retun any values. Example: void main ()
  • Derived Data types : These data types which are derived or originated from default data tpye or fundamental data types. Such type of datatypes are called Derived datatypes. Example of Derived datatypes are : Arrays, Function, Pointer, Reference. We will be discussing about all these topics and programs in detail in the coming tutorials.


No comments:

Post a Comment