Wednesday, 14 March 2012

programming Concepets, Variables, Data Types, Basic Data Type,


Programming Concepts-:

          Variables:-

                   Variable is a data item that can hold data, that can be modified during program execution in other words a variable is a name that C language compiler associates with a storage location in the main memory of the computer.

          Assigning a Name to a Variable:-

·        Variable can consist of any sequence of letters, digits and underscore.
·        Special characters are not allowed.
·        The first character of a variable should be a letter or an underscore (_).
·        Variable name is case sensitive. Reserved words (keywords) are not allowed as variable name.

Keywords:-

          Keywords are reserve words to do specific tasks. Meaning of these words has been declared to compiler so these words can not be used as identifiers. Keywords of C language are


Auto              default                float            register                  struct
Break             do                      for              return                    switch
Case              double                goto             short                     typedef
Char              else                     if                 signed                   union
Const            enum                  int                sizeof                    unsigned
Continue       extern                 long              static                     void
while


  Data Types:-

                   As we know that while programming we have to handle more than one type of data as whole number, decimal number, character, characters etc, to handle different type data in proper different type of data type are composed.

        Basic Data Type:-

                   The fundamental data types in C are char, int, float and double. Some of these data types may be modified by keywords short, long, signed, and unsigned. The modifiers short and long specify the amount of storage allocation to the fundamental type they modify. The modifiers signed and unsigned specify whether the most significant bit represents a sign bit or not. C language also supports derived data types such as pointer reference types, array and struct.


                                     
Type
Range
Byte
Represents

From
To


Char
-128
127
1
Characters
Unsigned char
0
255
1
Characters
Int
-32768
32767
2
Whole number
Unsigned int
0
65535
2
Whole number
Long
-2147434648
2147434647
4
Whole number
Unsigned long
0
4294967295
4
Whole number
Float
3.4*10-38
3.4*1038
4
Fractional number
Double
1.7*10-308
1.7*10308
8
Fractional number
Long double
3.4*10-4932
3.4*104932
10
Fractional number


No comments:

Post a Comment