Earn while u Learn

Tips tweaks hacks on computer with C C++ VB tutorials and ways to earn money online

ad

Elements of C

The elements of C are Character Set, Constants, Variables, Reserved words , Delimiters.
let us discuss all briefly:
1.  Character Set - there are two sets of Character Set in C.
 a. Source Characters - using this the source code or program is written. They are:
           I.  Alphabets :   A to Z,  a, to z  and ( _ ).
          II. Decimals:     0 to 9
         III. Special characters: + - * / ^ ~ % = \ ( ) [ ] { } ? " ' , ; : 
  b. Execution Characters: Some characters in C cannot be printed directly the require special code  that  is
           understood by C. Some of them are below:
  Execution character       Meaning               Result at execution
             \0                       End of string              Null ( nothing)
             \n                       End of line            Moves the active position to the initial position of next line.
             \r                       Carriage-return     Moves the active position to the initial position of the next logical line. 
         \v                  vertical tab      Moves the active position to the next vertical tabulation position.  
            \f                   Form feed       Moves the active position to the initial position of the next logical page. 
         \t                   horizontal tab   Moves the active position to the next horizontal tabulation position.  
         \b                  backspace       Moves the active position to the previous position of current line.
            \a                        alert                    produces an audible alert
            \\                         backslash           presents with backslash \
2. Constants: these are defined as the items which directly represent values and whose values cannot be changed during the execution of the program. With respect to the form and value it is classified into three types of constants. They are 
        a : numeric constants : A sequence of numeric digits with or without a decimal point. They are of two types namely integer numeric constants and floating point numeric constants.
            Ex: 1,2,3 , 321, 9.354, o6f58
        b: character constants: Any single character given within single quotes is called as character constant.
            Ex:  "s", "G", "1" , "@", "\0"
        c: string constant: A sequence of one or more characters surrounded by double quotes is called string constant. It is also known as Array of Character constants. These end up with \0 (known as string terminator)
            Ex:     " "              is null string
                      " www.a2zhacks.blogspot.com"                    is a string constant"
                      "a",  "A", " 5",  "5674hdd@ "          are also string constant.

3: Reserved Words: At the time of designing a language, Some words are kept as reserved words to determine or do some specific tasks or call a function. Such words in C are called reserved words.Some of them are:
 auto     break    case    char    const    continue    enum    do   double    default    else    extern    float    for   goto    if    int    long    register    return    signed    sizeof    short    static    struct    switch    typedef    union    unsigned    void    volatile    while    do    while

4: Delimiters : A delimiter is a symbol that has a special meaning or use in C. They do not specify any operation to yield a value. C language sentences, labels, array, are separated by special characters known as delimiters. they are:
Name              Delimiter               meaning
hash                       #                    pre processor directive
comma                   ,                    variable delimiter in variable list
colon                      :                    label delimiter
semi-colon              ;                   statement delimiter
parenthesis             ( )                 used in expressions
square brackets     [  ]                 Used in arrays
curly brackets        {  }                used to block C statements

5. Variables:  A quantity which may vary during the execution of the program is called a variable. These can take many values, one at a time. Once assigned, their values can be changed during the program execution. Values can be stored in a symbolic name (variable) in the computers memory and can be recalled back when required later.               

see also:
Data types                Input / output statements in C            Variable declaration in C
Operators

                     
     

0 comments:

Sign in / Join

Labels