Saturday, 24 September 2016

Loops Types in C Programming

A loop statement allows us to execute a statement or group of statements multiple times.
C programming language provides the following types of loops to handle looping requirements.
  •  while Loop

A while loop in C programming repeatedly executes a target statement as long as a given condition is true.
Syntax
The syntax of a while loop in C programming language is:



  • FOR LOOP

A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times.
Syntax
The syntax of a for loop in C programming language is:


  •  do…while Loop

Unlike for and while loops, which test the loop condition at the top of the loop, the do...while loop in C programming checks its condition at the bottom of the loop.
A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one time.

Syntax
The syntax of a do...while loop in C programming language is:



  •  

  •  Nested Loops

C programming allows to use one loop inside another loop. The following section shows a few examples to illustrate the concept.
Syntax
The syntax for a nested for loop statement in C is as follows:

 The syntax for a nested while loop statement in C programming language is as follows:

           The syntax for a nested do...while loop statement in C programming language is as follows:

Thursday, 22 September 2016

Decision making in C Programming

C  programming  language  assumes  any non-zero and non-null values  as true, and if it is  either zero or null, then it is assumed as false value.C  programming  language  provides  the  following  types  of  decision-making statements.

  •   if Statement 

An if statement  consists  of  a  Boolean  expression  followed  by  one  or  more statements.









  • if…else Statement 

An if statement  can  be  followed  by  an  optional else statement, which  executes when the Boolean expression is false.
Syntax 
The syntax of an if...else statement in C programming language is:





  •  if...else if...else Statement 

An if statement can be followed by an optional else  if...else statement, which is very useful to test various conditions using single if...else if statement.
Syntax 

  •  Nested if Statements 

It is always legal in C programming to nest if-else statements, which means you can use one if or else if statement inside another if or else if statement(s).
Syntax 
The syntax for a nested if statement is as follows:

                              

  •  Switch Statement 

A switch statement allows a variable  to be  tested  for equality against a  list of values.  Each  value  is  called  a  case,  and  the  variable  being  switched  on  is checked for each switch case.
Syntax 
The syntax for a switch statement in C programming language is as follows:









Wednesday, 14 September 2016

Operator Types in C Programming

An operator is a symbol that tells the compiler to perform specific mathematical or  logical functions.  C  language  is  rich  in  built-in  operators  and  provides  the following types of operators: 

  •   Arithmetic Operators 
  •   Relational Operators 
  •   Logical Operators 
  •   Bitwise Operators 
  •   Assignment Operators 
  •   Misc Operators 


 Relational Operators 











Tuesday, 13 September 2016

Classes types in C Programming

A  storage  class  defines  the  scope  (visibility)  and  life-time  of  variables  and/or functions within a C Program. They precede the type that they modify. We have four different storage classes in a C program:
  •  auto 
  •  register 
  •  static 
  •  extern