Welcome to WebmasterServe!

FREE TO JOIN! Join us now to engage in informative and friendly discussions about Webmastering, SEO, SEM, Internet Marketing, Programming, Graphic Design, Online Jobs and more. What are you waiting for? Ready to join our friendly community? It takes just one minute to register.

Dismiss Notice

Join WebmasterServe Forums 
Join the discussion! Have a better idea or an opinion? It takes just one minute to register Click Here to Join

My 2 Cents How To Use The For Loop In C++

Discussion in 'General Programming Discussions' started by Swati Mishra, Mar 14, 2016.

  1. Swati Mishra

    Yellow Belt

    Joined:
    Dec 28, 2015
    Messages:
    644
    Ratings:
    +105 / -0
    The For loop provides a compact way of specifying the statements that control the repetition of the steps within the loop. In the For loop, statement are not written within the body of the loop, statement are written at the top. The keyword For followed by the parenthesis and its containing three expression, which is separate by the semicolon. These are the initialization, the test expression and the increment or decrement expression.

    Syntax

    For (initialization; test expression; increment/decrement expression)
    {
    Statements;
    }
     
  2. krishatg

    Yellow Belt

    Joined:
    Jan 16, 2016
    Messages:
    240
    Ratings:
    +14 / -0
    You can further extend it to different types of loops i.e.
    While, do while, For
    Out of which while and for are entry restricted loops and do while is exit restricted loop. And also loops can be nested that means we can use one loop inside another loop.
     

Share This Page