Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1089211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:11:14+00:00 2026-05-16T23:11:14+00:00

I’m trying to figure out some answers to some questions and some difference between

  • 0

I’m trying to figure out some answers to some questions and some difference between While and For loops in C++ and also the reasons? Here’s what I’ve come up with so far. According to http://www.cplusplus.com/doc/tutorial/control/

While is:
while (expression) statement

and For is:
for (initialization; condition; increase) statement;

so in a for loop, the initialization is where we declare the variable to be used in the condition statement right?

The condition is under what conditions, will it loop.

Then increase is where we decide how much to add or subtract to the variable.

In a while loop the expression is also a condition right? Or are they completely different terms in this case?

I noticed that with the for loop I can move the increase part to the statement if I want to but I can’t in a While loop put an increase in parenthesis or declare a variable in the parenthesis (that initialization thing in a for loop). I was kind of curious what the reason is?

Anyways, I’m kind of teaching myself with the help of google, and advice from people, I’m pretty much completely new to programming so please take it easy on me, I’m not up to date with Jargon or complicated answers yet. 🙂 If you need more information or anything please tell me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T23:11:15+00:00Added an answer on May 16, 2026 at 11:11 pm

    for loops are more of a convenience that a true language construct. For example, a for loop can easily be expanded into a while loop.

    for ( c=0; c<10; c++ )
    is equivalent to

    c=0;
    while ( c<10 ) {
      // some statements
      c++;
    }
    

    Also, for loops aren’t limited to simple numeric operations, you can do more complex things like this (C syntax):

    // a very basic linked list node
    struct node {
      struct node *next;
    };
    struct node; //declare our node
    
    // iterate over all nodes from 'start' node (not declared in this sample)
    for ( node=start; node; node=node->next ) {}
    

    which will iterate over a simple linked list.

    You can also have multiple initializers, conditions, and statements (depending on the language) as such:
    for ( c=0, d=5; c<10, d<20; c++, d++ ). But I’d advise against crazy for loops like this as they get rather messy.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.