Thank you all for being with us.
Learn, Create and Implement.

  • Build Concept

    You can build your concept in programming on programsway.com.

  • Examples

    There are many C Programming examples on programsway.com.

  • Ask Questions

    Ask questions and get quick answers. Request any program and we will publish that program.

  • Monday, 12 August 2013

    Written by Kousik : 
    Every programming language has a grammar. Different programming language has different grammar. So to learn C programming language we have to be familiar with that grammar which is related to C program. The grammar is nothing but CONSTANTS, VARIABLES, & their DATA TYPES.
    CONSTANTS:
    There are two types of C constants. One is PRIMARY and other is SECONDARY.
    Primary constants are of three types.
    1)      Integer Constant
    2)      Real Constant
    3)      Character Constant
    Secondary constants are of several types.
    1)      Array
    2)      Pointer
    3)      Structure
    4)      Union
    5)      Enum etc…
    Now we have to primary constants first…
    Integer Constants:
    Characteristics: a) An integer constants must have at least one digit. It must not have a decimal point.
                                    b) It can either positive or negative. If no sign proceeds then the integer assumed to be positive.
                                    c) The range for integer constants is -2147483648 to +2147483647. The range of integer constants is depend upon the compiler (visual studio, gcc  , turbo c etc).
    Example : 400, -421,+755 etc
    Real Constants (Floating Point Constants) :
    Real constants can be shown in two forms. One is fractional form and other is exponential form.
    Characteristics   of Fractional form  :
    a)      A real constants must have at least one digit . It must have a decimal point.
    b)      It can be either positive or negative. If no sign proceeds then the integer assumed to be positive.
    c)       No blanks are allowed within a real constant.
    Example  : -69.35 , 12.00 , +39.355 etc
    In exponential form the real is represented in two major parts  . The part coming before ‘e’ is called ‘mantissa’ and the part coming after ‘e’ called ‘exponent’ .
    Characteristics of exponential form:
    a)      The word ‘e’ separate the exponential part and the mantissa part of real constants.
    b)      The mantissa part may have +ve or –ve sign. . If no sign proceeds then the integer assumed to be positive.
    c)       The exponent must have at least one digit.
    d)      Range = -3.4e38 to +3.4e38
    Example: 3.2e-23, -0.45e+33 etc
    Character Constants:
    Characteristics
    a)      A character constant can be a single alphabet, single digit or a single special symbol enclosed with single inverted commas.
    b)      The maximum length of a character constant is 1 character.
    Example: ‘A’, ‘c’, ‘5’, ‘/’ etc
    *Secondary constants will be discussed later.
    VARIABLE:
    To store the data value in computer memory we have to know about VARIABLES.  Variables names are names given to location in memory. These locations can contain Integer, real, character constants .Type of variables are depending upon the type of constants. For example an integer type of variable can holds only the integer constants. The variable name is chosen by the programmer in such a way that shows its nature in the program.
    Example:  class, roll, count etc
    Characteristics of variables:
    a)      They must begin with a letter.
    b)      A variable name is any combination of 1 to 31 alphabets, digits or underscores. The length of variables is depending upon the compiler.
    c)       No special symbol other than an underscore can be used in a variable name.
    d)      Uppercase and lowercase are very significant.

    C KEYWORDS:
    C compiler has some words whose meaning has already been explained. There are 32 keywords available in C. Different keywords have different meaning.
     auto                       double                     int                                        struct
     Break                     else                        long                                      switch
     case                       enum                      register                                typedef
     char                       extern                     return                                  union
     const                     float                        short                                 unsigned
     continue                 for                            signed                                  void
     default                  goto                         sizeof                                   volatile
     do                          if                           static                                    while
    To know more about c keywords you can follow LET UC C(by yashvant kanetkar) & ANSI C (by Balaguruswamy) .










                    `              




    0 comments:

    Post a Comment