Forum

Loops In C Programming

This thread contains 2 replies, has 3 voices, and was last updated by darshan.soni007 1 year, 8 months ago.

  • Author Replies
    • #50617

      Why do some people like using for loops instead of while loops?


    • Anonymous
      #50618

      Hello Richi,

      Most programmers prefer “for loops”.
      A for-loop in most languages will allow declaration of variables with lifetime persisted over the entire loop across iterations, and will typically also allow the evaluation of a specified expression after each iteration. These are nothing more than syntactical convenience, but they’re a convenience that can often prevent a great many bugs.

      Hope this would be helpful.


    • #50871

      There is one reason to choose “for loop” over “while loop“: Readability.

      By using a for loop, you’re expressly stating your intent is to perform some type of operating that requires initialization, a “step” operation, and a completion condition.

      With while, on the other hand, you’re only stating you need the completion condition.


Viewing 2 reply threads

You must be to reply to this thread.Please or . Registration is 100% free.

GET FREE CONSULTATION

Call Us Now For Free Consultation97370 05566

Our experts listen to you patiently and suggest you the right course after conducting a personality profile test. Register your interest below to schedule personality profile test for you.

SUBSCRIBE TO OUR NEWSLETTER

Contact Us

Working Hours

  • Monday9:00 AM – 9:00 PM
  • Tuesday9:00 AM – 9:00 PM
  • Wednesday9:00 AM – 9:00 PM
  • Thursday9:00 AM – 9:00 PM
  • Friday9:00 AM – 9:00 PM
  • Saturday9:00 AM – 9:00 PM
  • SundayClosed
Copyright 2016-2020 Smart Mentors. All Rights Reserved.

Login

FORGOT PASSWORD

Sign up now to Become An Instructor

Register your Interest