Tuesday, 18 December 2012

Data Type 'int'

  • Data :-
              The values given to the program to perform various operations on it, is referred to as data.

  • Data Type 'int' :
                  The 'int' stands for integer. An integer is a whole number without decimal part. It may have a positive or a negative value. The numbers 0, 1, 2, 3, ...., and their negatives -1, -2, -3, ....., are example of integers.
                               The 'int' data type is used to store whole values. It takes 2 bytes in memory. The 'int' type variables can store values from  -32768 to 32767 (-215 to 215 -1). If a  value greater then 32767 is assigned to an 'int' type variable then correct value will not be assigned (or fit) in the memory allocated to that variable. This condition is called integer overflow. When overflow occurs, the program continues to run but it produces incorrect result.

Saturday, 4 August 2012

Data Types in C

  • Data:-
                  The values given to the program to perform various operations on it, is referred to as data.

  • Types of Data in C:-

                          The data type defines the set of values and a set of operations that can be performed on those values. The data is given to the program as input. The data is processed according to the program instructions and output is returned.
                                 In program designing, the data and its types are defined before designing the actual program used to process the data. The values or data used in a program may be of different types. In a C program, each variable is associated with a specific data type.
                       C language provides standard data types. A standard data type is one of that is predefined in the language.

  • For Example:-

  1. int
  2. float
  3. double
  4. char
C language also allows the user to define its own data types known as user defined data types.

Types of Identifiers

  • Types of Identifiers:-
                 There are two types of Identifiers in C. These are:
  1. Standard Identifier
  2. User defined Identifier

  • Standard Identifier:-
                          Like keywords, there are also predefined identifiers in C. The predefined identifiers of the C language that are used for special purposes in the source program are called the standard Identifier. Each identifier has special meanings in C. The names used for standard library functions are standard identifiers.
  • For Example:-
                  In C program, the scanf() and printf() functions are mostly used for input or output operations. Therefore, the functions names ''scanf'' or "printf" are examples of standard identifiers.
  • User Defined Identifiers:-
                         The user (or programmer) can define its own identifiers in the C program such as variables, user defined functions, labels etc. The Identifiers defined by the user in the program are called user defined IdentifiersC is a case sensitive language. 
  • For Example:-
                    The C compiler considers 'Area' and 'area' as two different identifiers.