Loops In C Programming

This thread contains 2 replies, has 3 voices, and was last updated by darshan.soni007 5 years, 3 months ago.

  • Author Replies
    • #50617

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

    • Anonymous

      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.


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.


Copyright 2016-2024 Smart Mentors. All Rights Reserved.



Sign up now to Become An Instructor

    Register your Interest

      cf7captchaRegenerate Captcha