Thursday, 18 January 2018

Basic1


Signed and unsigned variables

The difference between signed and unsigned variables is that signed variables can be either negative or
positive but unsigned variables can only be positive. By using an unsigned variable you can increase the maximum positive range. When you declare a variable in the normal way it is automatically a signed variable. To declare an unsigned variable you just put the word unsigned before your variable declaration or signed for a signed variable although there is no reason to declare a variable as signed since they already are.

Calculations and variables

There are different operators that can be used for calculations which are listed in the following table:
Operator
Operation
+
Addition
Subtraction
*
Multiplication
/
Division
%
Modulus(Remainder of integer
division)

         int main()
                                  {
                  
                                     int a ,b;
                                  a=1 ;
                           b=a+1;
                      a=b-1;
               return 0;
                                              }
      

Reading and printing

Calculating something without reading input or printing something on the screen is not much fun. To read input from the keyboard we will use the command scanf. (How to print something to the screen we all ready know).
    
    So let’s make a program that can do all these things:

#include<stdio.h>

int main()
{
 int a;

 scanf("%d", &a);
 a= a * 10;
 printf("Ten times the input equals %d\n",inputvalue);
 return 0;
}


the %d is for reading or printing a decimal integer value (It is also possible to use %i). In the table below you can find the commands for other types:
%i or %dint
%cchar
%ffloat
%lfdouble
%sstring

  

Boolean Operators

Before we can take a look at test conditions we have to know what Boolean operators are. They are called Boolean operators because they give you either true or false when you use them to test a condition. The greater than sign “>”
for instance is a Boolean operator. In the table below you see all the Boolean operators:
==Equal
!Not
!=Not equal
>Greater than
<Less than
>=Greater than or equal
<=Less than or equal
&&And
||Or
  
    

The if statement

The if statement can be used to test conditions so that we can alter the flow of a program. In other words: if a specific statement is true, execute this instruction. If not true, execute this instruction. So lets take a look at an example:
       #include<stdio.h>
     int main()
     {
             int mynumber;
            scanf("%d",&mynumber);
            if (mynumber==10)
              printf("is equal to");
          return 0;
          }
In the example above the user can input a number. The number is stored in the variable mynumber.
Now take a look at the “if statement”: if the number stored in the variable mynumber is equal to ten, then print “is equal” on the screen. Simple, isn’t it. If the number is not equal to ten, then nothing gets printed.
Now we like to also print something if the “if statement” is not equal. We could do this by adding another “if statement” but there is an easier / better way. Which is using the so called “else statement” with the “if statement”.
  #include<stdio.h>
int main()
      {
       int mynumber;
          scanf("%d",&mynumber);
              if (mynumber ==10)
                     {
                           printf("is equal \n");
                             printf("close program\n");
                       }
                            else
                 {
                          printf("not equal \n");
                       printf("closing program\n");
                    }
                             return 0;
                  }





























     



























































First C programe



First C program to print Hello World

#include <stdio.h>

      int main()
{
           printf("Hello World \n");
         
  return 0;
                          }

Save the program with the name : hello.c
=============================================================

#include<stdio.h>

With this line of code we include a file called stdio.h. (Standard Input/Output header file). This file lets us use certain commands for input or output which we can use in our program. (Look at it as lines of code commands) that have been written for us by someone else). For instance it has commands for input like reading from the keyboard and output commands like printing things on the screen.

int main()

The int is what is called the return value (in this case of the type integer). Where it used for will be explained further down. Every program must have a main(). It is the starting point of every program. The round brackets are there for a reason, in a later tutorial it will be explained, but for now it is enough to know that they have to be there.

{}

The two curly brackets (one in the beginning and one at the end) are used to group all commands together. In this case all the commands between the two curly brackets belong to main(). The curly brackets are often used in the C language to group commands together. (To mark the beginning and end of a group or function.).

printf(“Hello World\n”);

The printf is used for printing things on the screen, in this case the words: Hello World. As you can see the data that is to be printed is put inside round brackets. The words Hello World are inside inverted ommas, because they are what is called a string. (A single letter is called a character and a series of characters is called a string). Strings must always be put between inverted commas. The \n is called an escape sequence. In this case it represents a newline character. After printing something to the screen you usually want to print something on the next line. If there is no \n then a next printf command will print the string on the same line.

return 0;

When we wrote the first line “int main()”, we declared that main must return an integer int main(). (int is short for integer which is another word for number). With the command return 0; we can return the value null to the operating system. When you return with a zero you tell the operating system that there were no errors while running the program. 
=========================================================

Variables

If you declare a variable in C (later on we talk about how to do this), you ask the operating system for a piece of memory. This piece of memory you give a name and you can store something in that piece of memory (for later use). There are two basic kinds of variables in C which are numeric and character.

Numeric variables

Numeric variables can either be of the type integer (int) or of the type real (float). Integer (int) values are whole numbers (like 10 or -10). Real (float) values can have a decimal point in them. (Like 1.23 or -20.123).

Character variables

Character variables are letters of the alphabet, ASCII characters or numbers 0-9. If you declare a character variable you must always put the character between single quotes (like so ‘A’ ). So remember a number without single quotes is not the same as a character with single quotes.

Constants

The difference between variables and constants is that variables can change their value at any time but constants can never change their value. (The constants value is lockedfor the duration of the program). Constants can be very useful, Pi for instance is a good example to declare as a constant.

Data Types

So you now know that there are three types of variables: numeric – integer, numeric-real and character. A variable has a type-name, a type and a range (minimum / maximum). In the following table you can see the type-name, type and range:
Type-nameTypeRange
intNumeric – Integer-32 768 to 32 767
shortNumeric – Integer-32 768 to 32 767
longNumeric – Integer-2 147 483 648 to 2 147 483 647
floatNumeric – Real1.2 X 10-38 to 3.4 X 1038
doubleNumeric – Real2.2 X 10-308 to 1.8 X 10308
charCharacterAll ASCII characters

Declaring

So we now know different
type-names and types of variables, but how do we declare them. Declaring a variable is very easy. First you have to declare the type-name. After the type-name you place the name of the variable. The name of a variable can be anything you like as long it includes only letters, underscores or numbers (However you cannot start the name with a number). But remember choose the names wisely. It is easier if a variable name reflects the use of that variable. (For instance: if you name a float PI, you always know what it means).
Now let’s declare some variables, a variable MyIntegerVariable and MyCharacterVariable:

 int main()
 {
  int MyIntegerVariable;
  int MyCharacterVariable;
  return 0;
 }
 
It is possible to declare more than one variable at the same time:

 int main()
 {
  int Variable1, Variable2, Variable3;
  int abc, def, ghi;
  return 0;
 }
 
To declare a constant is not much different then declaring a variable. The only difference is that you have the word const in front of it:

 int main()
 {
  const float PI = 3.14;
  char = 'A';
  return 0;                                                                  
 }


Wednesday, 17 January 2018

UNIT 2 :FUNDAMENTAL OF C PROGRAMMING




FUNDAMENTAL OF C PROGRAMMING
  1. Character Set
character:-          It denotes any alphabet, digit or special symbol used to represent information. 
Use:-                      These characters can be combined to form variables. C uses constants, variables, operators, keywords and expressions as building blocks to form a     basic C program. 
Character set:-    The character set is the fundamental raw material of any language and they are used to represent information. Like natural languages, computer   language will also have well defined character set, which is useful to build the programs
The characters in C are grouped into the following two categories:
1.      Source character set
                                a.      Alphabets
                                b.      Digits
                                c.      Special Characters
                                d.      White Spaces
2.      Execution character set
                                a.     Escape Sequence
Source character set
ALPHABETS
            Uppercase letters                 A-Z
            Lowercase letters                 a-z
DIGITS                                                  0, 1, 2, 3, 4, 5, 6, 7, 8, 9
SPECIAL CHARACTERS
 ~          tilde                            %         percent sign               |           vertical bar         @        at symbol               +          plus sign                    <          less than
_          underscore                -           minus sign                 >          greater than       ^          caret                        #          number sign              =          equal to
&         ampersand                 $          dollar sign                 /           slash                  (           left parenthesis      *          asterisk                      \           back slash
)           right parenthesis       ′           apostrophe                :           colon                  [           left bracket               "          quotation mark         ;           semicolon
]           right bracket              !           exclamation mark     ,           comma                { left flower brace               ?            Question mark       .           dot operator            
}            right flower brace     
WHITESPACE CHARACTERS
\b         blank space               \t          horizontal tab                       \v         vertical tab             \r         carriage return          \f         form feed                   \n         new line
        
\\          Back slash                 \’         Single quote                          \"         Double quote       \?         Question mark          \0         Null                            \a         Alarm (bell). 
Execution Character Set
Certain ASCII characters are unprintable, which means they are not displayed on the screen or printer. Those characters perform other functions aside from displaying text. Examples are backspacing, moving to a newline, or ringing a bell. 
They are used in output statements. Escape sequence usually consists of a backslash and a letter or a combination of digits. An escape sequence is considered as a single character but a valid character constant. 
These are employed at the time of execution of the program. Execution characters set are always represented by a backslash (\) followed by a character. Note that each one of character constants represents one character, although they consist of two characters. These characters combinations are called as escape sequence.


  1. Token
Token are classified as Keyword, Identifier, Constant, Operator.
Keywords
C programs are constructed from a set of reserved words which provide control and from libraries which perform special functions. The basic instructions are built up using a reserved set of words, such as main, for, if, while, default, double, extern, for, and int, etc., C demands that they are used only for giving commands or making statements. You cannot use default, for example, as the name of a variable. An attempt to do so will result in a compilation error. 
Keywords have standard, predefined meanings in C. These keywords can be used only for their intended purpose; they cannot be used as programmer-defined identifiers.  Keywords are an essential part of a language definition. They implement specific features of the language. Every C word is classified as either a keyword or an identifier. A keyword is a sequence of characters that the C compiler readily accepts and recognizes while being used in a program. Note that the keywords are all lowercase. Since uppercase and lowercase characters are not equivalent, it is possible to utilize an uppercase keyword as an identifier.

  • The keywords are also called ‘Reserved words’.
  • Keywords are the words whose meaning has already been explained to the C compiler and their meanings cannot be changed.
  • Keywords serve as basic building blocks for program statements.
  • Keywords can be used only for their intended purpose.
  • Keywords cannot be used as user-defined variables.
  • All keywords must be written in lowercase.
  • 32 keywords available in C.
Data types
Qualifiers  
User-defined  
Storage Classes
Loop
 Others
Decision
Jump
Derived
 function
Int
Char
Float
Double
signed
unsigned
short
long
typedef
enum
auto
extern
register
static
for
while
do
const
volatile
sizeof
If
else
switch
case
default


goto
continue
break
struct
union
void
return


Restrictions apply to keywords 

  • Keywords are the words whose meaning has already been explained to the C compiler and their meanings cannot be changed.
  • Keywords can be used only for their intended purpose.
  • Keywords cannot be used as user-defined variables.
  • All keywords must be written in lowercase.
Data type Keywords
int                 Specifies the integer type of value a variable will hold
char             Specifies the character type of value a variable will hold
float             Specifies the single-precision floating-point of value a variable will hold
double         Specifies the double-precision floating-point type of value a variable will
Qualifier Keywords
signed         Specifies a variable can hold positive and negative integer type of data 
unsigned    Specifies a variable can hold only the positive integer type of data 
short            Specifies a variable can hold fairly small integer type of data
long             Specifies a variable can hold fairly large integer type of data
Loop Control Structure Keywords
For                  Loop is used when the number of passes is known in advance
While              Loop is used when the number of passes is not known in advance
Do                   Loop is used to handle menu-driven programs


User-defined type Keywords

typedef           Used to define a new name for an existing data type
Enum             Gives an opportunity to invent own data type and define what values the variable of this data type can take
Jumping Control Keywords
Break             Used to force immediate termination of a loop, bypassing the conditional expression and any remaining code in the body of the loop
continue        Used to take the control to the beginning of the loop bypassing the statements inside the loop
Goto               Used to take the control to required place in the program 
Storage Class Keywords
Storage Classes            Storage                            Default initial value                      Scope                             Life
auto                                   Memory                         An unpredictable value                  Local             Till the control remains within the block
register                            CPU registers            Garbage value                                  Local             Till the control remains within the block
static                                Memory                         Zero                                                   Local             Value of the variable persists between different function calls
extern                               Memory                        Zero                                                   Global            Till the program’s execution doesn’t come to an end
  1. Identifier
Identifiers
Identifiers are names for entities in a C program, such as variables, arrays, functions, structures, unions and labels. An identifier can be composed only of uppercase, lowercase letters, underscore and digits, but should start only with an alphabet or an underscore. If the identifier is not used in an external link process, then it is called as internal. Example: Local variable. If the identifier is used in an external link process, then it is called as external. Example: Global variable

An identifier is a string of alphanumeric characters that begins with an alphabetic character or an underscore character that are used to represent various programming elements such as variables, functions, arrays, structures, unions and so on. Actually, an identifier is a user-defined word. There are 53 characters, to represent identifiers. They are 52 alphabetic characters (i.e., both uppercase and lowercase alphabets) and the underscore character. The underscore character is considered as a letter in identifiers. The underscore character is usually used in the middle of an identifier. There are 63 alphanumeric characters, i.e., 53 alphabetic characters and 10 digits (i.e., 0-9).
Rules for constructing identifiers

1.     The first character in an identifier must be an alphabet or an underscore and can be followed only by any number alphabets, or digits or underscores.
2.     They must not begin with a digit.
3.     Uppercase and lowercase letters are distinct. That is, identifiers are case sensitive.
4.     Commas or blank spaces are not allowed within an identifier.
5.     Keywords cannot be used as an identifier.
6.     Identifiers should not be of length more than 31 characters.
7.     Identifiers must be meaningful, short, quickly and easily typed and easily read.
Valid identifiers:      total    sum     average          _x        y_        mark_1           x1
Invalid identifiers    
                                                     1x       -           begins with a digit
                                                    char    -           reserved word
                                                    x+y      -           special character
Note: Underscore character is usually used as a link between two words in long identifiers.
kinds of identifiers
       
C defines two kinds of identifiers:

  • Internal
  • External

Internal identifier   

                                If the identifier is used in an external link process, then it is called as 
external. These identifiers are also known as external names; include function names and global variable names that are shared between source files. It has at least 63 significant characters.
External identifier
                                    If the identifier is not used in an external link process, then it is called as 
internal. These identifiers are also known as internal names; includes the names of local variables. It has at least 31 significant characters.





Differentiate between Keywords words and identifiers

                            
Keyword                                                                                                                     Identifier

Predefined-word                                                                                                        User-defined word
Must be written in lowercase only                                                                          Can written in lowercase and uppercase
Has fixed meaning                                                                                                    Must be meaningful in the program
Whose meaning has already been explained to the C compiler                     Whose meaning not explained to the C compiler
Combination of alphabetic characters                                                                  Combination of alphanumeric characters
Used only for it intended purpose                                                                          Used for required purpose
Underscore character is not considered as a letter                                           Underscore character is considered as a letter


  1. Constant
Constants
                         Constants in C are fixed value that does not change during the execution of a program. Constants can be of any of the basic data types. C supports several types of constants in C language as 
C constants
                a.     Numeric Constants  
                                 i.      Integer Constant 
                                                 1.     Decimal Integer constant
                                                 2.     Octal integer constant 
                                                 3.     Hexadecimal Integer constant
                                 ii.      Real Constant 
                b.     Character Constants
                                 i.      Single Character Constant
                                 ii.     String Constant
                c.      Backslash Character constants
                d.      Symbolic constants
  1. Numeric Constant
There are two types of numeric constants,
1) Integer constants  2)   Real or floating-point constants

Integer constants

  • Any whole number value is an integer.
  • An integer constant refers to a sequence of digits without a decimal point.
  • An integer preceded by a unary minus may be considered to represent a negative constant
    Example:            0          -33      32767
There are three types of integer constants namely,
                a)     Decimal integer constant                      
                b)     Octal integer constant
                c)     Hexadecimal integer constant     
Decimal Integer constant (base 10)          

  • It consists of any combinations of digits taken from the set 0 through 9, preceded by an optional – or + sign.
  • The first digit must be other than 0.
  • Embedded spaces, commas, and non-digit characters are not permitted between digits. 
    Valid:             0          32767     -9999          -23
    Invalid: 
                        12,245            -   Illegal character (,)
                        10  20  30       -   Illegal character (blank space)



Octal Integer Constant (base 8) 

  • It consists of any combinations of digits taken from the set 0 through 7.
  • If a constant contains two or more digits, the first digit must be 0.
  • In programming, octal numbers are used.
    Valid:                   037                 0          0435
    Invalid:
                            0786               -           Illegal digit 8
                            123                 -           Does not begin with zero
                            01.2                -           Illegal character (.)
Hexadecimal integerconstant

  • It consists of any combinations of digits taken from the set 0 through 7 andalso a through f (either uppercase or lowercase).
  • The letters a through f (or A through F) represent the decimal quantities 10 through 15 respectively.
  • This constant must begin with either 0x or 0X.
  • In programming, hexadecimal numbers are used.
    Valid Hexadecimal Integer Constant:            0x            0X1             0x7F            
    Invalid Hexadecimal Integer Constant:         
                                                                                0xefg  -           Illegal character g
                                                                                123     -           Does not begin with 0x
Unsigned integer constant:        An unsigned integer constant specifies only positive integer value. It is used only to count things. This constant can be identified by appending the letter u or U to the end of the constant.  
Valid:             0u          1U         65535u       0x233AU
Invalid:          -123      -         Only positive value
Long integer constant:     A long integer constant will automatically be generated simply by specifying a constant that exceeds the normal maximum value. It is used only to count things. This constant can be identified by appending the letter l or L to the end of the constant.           
Valid:             0l23456L       0x123456L    -123456l
Invalid:          0x1.2L            -           Illegal character (.)
Short integer constant:    A short integer constant specifies small integer value. This constant can be identified by appending the letter s or S to the end of the constant.
Valid:             123s                -456           32767S
Invalid:          
                        12,245                   -    Illegal character (,)
                        10  20  30  -   Illegal character (blank space)
Note: - A sign qualifier can be appended at the end of the constant. Usually suffixes(s or S, u or U, l or L) are not needed. The compiler automatically considers small integer constants to be of type short and large integer constants to be of type long.
Rules for constructing Integer constants  
i.               An integer constant must have at least one digit.
ii.              It must not have a decimal point.
iii.             It can be either positive or negative.
iv.             If no sign precedes an integer constant, it is assumed to be positive.
v.              Commas or blanks are not allowed within an integer constant.


Real or Floating-point constant 
                    
                        Constants in C are fixed value that does not change during the execution of a program. A real constant is combination of a whole number followed by a decimal point and the fractional partExample: 0.0083   -0.75   .95   215.        
  Use of Real or Floating-point constants 
                        
                    Integer numbers are inadequate to represent quantities that vary continuously, such as distances, heights, temperatures, prices and so on. These quantities are represented by numbers containing fractional part. Such numbers are called real or floating point constants. 
The Real or Floating-point constants can be written in two forms: 
                    1.      Fractional or Normal form           
                    2.      Exponential or Scientific form
Express a Real constant in fractional form 
                    A real constant consists for a series of digits representing the whole part of the number, followed by a decimal point, followed by a series of representing the fractional part. The whole part or the fractional part can be omitted, but both cannot be omitted. The decimal cannot be omitted. That is, it is possible that the number may not have digits before the decimal point or after the decimal point.          
Valid Real constants (Fractional): 0.0      -0.1     +123.456       .2         2.
Invalid Real constant: -                  1              -           a decimal point is missing
                                                            1, 2.3      -           Illegal character (.)
Rules for Constructing Real Constants in Fractional Form
1.    A real constant must have at least one digit.
2.    It must have a decimal point.
3.    It could be either positive or negative.
4.    Default sign is positive.
5.    Commas or blanks are not allowed within a real constant.
Express a real constant in Exponential form 
                    A real constant is combination of a whole number followed by a decimal point and the fractional part. If the value of a constant is either too small or too large, exponential form of representation of real constants is usually used. 
In exponential form, the real constant is represented in two parts. 
                Mantissa       -           The part appearing before e, the mantissa is either a real number expressed in decimal notation or an integer.
                Exponent      -           The part following e, the exponent is an integer with an optional plus or minus sign followed by a series of digits. The letter e separating the                                                     mantissa and the exponent can be written in either lowercase or uppercase.
                Example:         0.000342 can be represented in exponential form as 3.42e-4
                                          7500000000 can be represented in exponential form as 7.5e9 or 75E8
Rules for Constructing Real Constants in Exponential Form
1.      The mantissa part and the  exponential part should be separated by letter in exponential form
2.      The mantissa part may have a positive or negative sign.
3.      Default sign of mantissa part is positive.
4.      The exponent part must have at least one digit, which must be a positive or negative integer. Default sign is positive.
5.      Range of real constants expressed in exponential for is -3.4e38 to 3.4e38.
Character:    A character denotes an alphabet, digit or a special character. 
Single Character constants:   A single character constant or character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the inverted commas should point to the left
For example, Û¥AÛ¥ is a valid character constant whereas ‛AÛ¥ is not. Note that the character constant Û¥ 5Û¥ is not the same as the number 5.
Valid Character Constants:                             Û¥mÛ¥           Û¥=Û¥            Û¥AÛ¥
Û¥Invalid:                                                                 Û¥123Û¥        -     Length should be 1
                                                                               "A"           -     Enclosed in single quotes   
Note: - Each single character constant has an integer value that is determined by the computer’s particular character set. 
Rules for Constructing Single Character constants
1.     A single character constant or character constant is a single alphabet, a single digit or a single special symbol enclosed within single inverted commas. Both the 
        inverted commas should point to the left.
2.    The maximum length of a single character constant can be one character.
3.    Each character constant has an integer value that is determined by the computer’s particular character set. 


String Constant
  •         A character string, a string constant consists of a sequence of characters enclosed in double quotes.
  •         A string constant may consist of any combination of digits, letters, escaped sequences and spaces.  Note that a character constant Û¥AÛ¥
                  and the corresponding single character string constant "A" are not equivalent.
                 Û¥AÛ¥        -           Character constant   -           Û¥AÛ¥
                "A"       -           String Constant           -           Û¥AÛ¥        and Û¥ \0Û¥ (NULL)
                The string constant "A" consists of character A and \0. However, a single character string constant does not have an equivalent integer value. It occupies two         
                bytes, one for the ASCII code of A and another for the NULL character with a value 0, which is used to terminate all strings. 
                Valid String Constants: -                "W"                 "100"              "24, Kaja Street"
                Invalid String Constants: -             "W              the closing double quotes missing
                                                                            Raja"         the beginning double quotes missing
Rules for Constructing String constants
1)        A string constant may consist of any combination of digits, letters, escaped sequences and spaces enclosed in double quotes.
2)        Every string constant ends up with a NULL character which is automatically assigned (before the closing double quotation mark) by the compiler.
Difference between single character constant and string constant
                                Character Constant                                                                                                                               String Constant
A character constant is enclosed within single inverted commas.                                         A sequence of characters enclosed in double quotes
The maximum length of a character constant can be one character.                                     A string constant can be any length.
A single character string constant has an equivalent integer value.                                       A single character string constant does not have an equivalent integer value.
The character constant ‘A’ consists of only character A.                                                           The string constant "A" consists of character A and \0.
A single character constant occupies one byte.                                                                          A single string constant occupies two bytes
Every character constant does not end up with a NULL character.                                         Every string constant ends up with a NULL character which is automatically 
                                                                                                                                                              assigned (before the closing double quotation mark) by the compiler


Operators
Operator

An operator is a symbol or a special character that tells the computer to perform certain mathematical or logical manipulations which is applied to operands to give a result. It can operate on integer and real numbers.

Usage
  • Operators are used in programs to manipulate data and variables. They usually form a part of mathematical or logical expressions.

operands

    The data items that operators act upon to evaluate expressions are called as operands.
    Most operators require two or more operands while others act upon a single operand. 
    Most operators allow the individual operands to be expressions. 
    A few operators permit only single variables as operands. 
    The operands can be integer quantities, floating-point quantities or characters

Various types of Operators
C supports a rich set of operators. C operators can classified as

  • Arithmetic Operators
  • Relational Operators
  • Logical Operators
  • Assignment Operators
  • Arithmetic assignment Operators
  • Increment and Decrement Operators
  • Conditional Operator
  • Bitwise Operators
  • Special Operators

List of Arithmetic operators  (Or) List of Binary operators 
Operator               Meaning
   +                          Addition
     -                         Subtraction
    *                          Multiplication
     /                          Division
    %                         Modulo operation( remainder after integer division
List of Relational operators 
Operator              Meaning
   >                         Greater than
    <                        Less than
    >=                      Greater than or equal to
    <=                      Less than or equal to
    ==                      Equal to
    !=                       Not equal to
List of Equality operators
Operator                Meaning
    ==                       Equal to
    !=                        Not equal to
List of Logical operators
Operator                Meaning
    &&                       Logical AND
    ||                           Logical OR
    !                            Logical NOT
List of Unary operators
Operator                Meaning
     -                          Unary minus
    ++                        Increment by 1
    - -                          Decrement by 1
    sizeof()               Returns the size of the operand




List of Conditional operators (Or) List of Ternary operators
Operator                Meaning
      ?:                       Conditional operator
List of Increment and Decrement operators
Operator                Meaning
    ++                        Increment by 1
    --                          Decrement by 1
 List of Arithmetic assignment operators (Or) List of Shorthand assignment operators (Or)  List of Compound assignment operators
Operator                Meaning
    +=                        Addition assignment
    -=                         Subtraction assignment
     *=                        Multiplication assignment
     /=                         Division assignment
    %=                        Modulus assignment
List of Bitwise operators
Operator                Meaning
    ~                          One’s Complement
    <<                        Left shift
    >>                        Right shift
    &                          Bitwise AND
    |                            Bitwise OR
    ^                           Bitwise X-OR
List the Special operators 
Operator                Meaning
    ,                           Comma operator
    *                          Pointer operator
    &                         Address of operator
    .                           Dot operator
    ->                        Member Access operator
=======================================
Arithmetic operators are used in mathematical expressions in the same way that they are used in algebra. C provides all the basic arithmetic operators. They can operate on any built-in numeric data type of C. They cannot be used as Boolean type, but can use them on char types, since the char type in C is, essentially, a subset of int
Operator                Meaning                Example        Result    (a=14, b=4)
+                            Addition                     a+b                 18
-                            Subtraction                a-b                  10
*                           Multiplication             a*b                   56
/                            Division                      a/b                    3
%                        Modulo operation     a%b                  2
                           (remainder after integer division)
All the above operators are called Binary operators as they act upon two operands at a time. The operands acted upon by arithmetic operators must represent numeric values. Thus, the operands can be integer quantities, floating-point quantities or characters (the character constants represent integer values, as determined by the computer’s character set.
If one or both operands represent negative values then the addition, subtraction, multiplication and division operations will result in values whose signs are determined by the usual rules of algebra.
About Division Operator (/): - Division of one integer quantity by another is referred to as integer division. This operation always results in a truncated quotient (i.e., the decimal portion of the quotient will be dropped). If a division operation is carried out with two floating-point numbers or with one floating-point number and one integer, the result will be a floating-point quotient. The division operator (/) requires that the second operand be nonzero. 
About Remainder Operator (%): - The remainder operator (%) requires that both operands be integers and the second operand be nonzero. When one of the operands is negative, the sign of the first operand is the sign of the result operand. Note: Beginners should exercise care in the use of remainder operation when one of the operands is negative. 
Example:  11 % 3 = 3:           -11 % 3 = -2:      11 % -3 = 2:    -11 % -3 = -2
The % operator is sometimes referred to as the modulus operator.
Among the arithmetic operators, *, / and % fall into one precedence group and  + and – fall into another. The first group has a higher precedence than the second. Thus, multiplication, division and remainder operations will be carried out before addition and subtraction. Example: a=10; b=5;  c = a + b*2;     c is 20.


/* Arithmetic operations using Arithmetic operators */   
#include <stdio.h>
#include <conio.h>
main()
{
            int a, b, c;
            clrscr();
            printf ("Enter a and b");
            scanf ("%d %d", &a,&b);
            printf ("Addition: %d\n", a+b);
            printf ("Subtraction: %d\n", a-b);
            printf ("Multiplication: %d\n", a*b);
            printf ("Division: %d\n", a/b);
            printf ("Modulus: %d ", a%b);
            getch();
}
Output:-
Enter a and b:            10 20
Addition:                   30
Subtraction:              -10
Multiplication:         200
Division:                    0
Modulus:                   0
Difference between Division operator and Modulus operator
                                Division Operator (/)                                                                                                                                Modulus Operator (%)
The interpretation of the remainder                                                                                                     The interpretation of the remainder operation is unclear when one of the             operation is clear when one of the operands is negative                                                               operands is negative
If a division operation is carried out with two floating-point numbers                                          The remainder operator (%) requires that both operands be integers only.
or with one floating-point number and one integer, 
the result will be a floating-point quotient.
The use of the division operation is determined by the usual rules of algebra.                         Beginning programmers should exercise care in the use of the remainder                                                                                                                                                                             operation.
Example: -       7 / 2 = 3                                                                                                                           Example:-          7 % 2 = 1
========================================