This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Strange problem with loop

Hi.

Ive been programing for nearly five months now so I am not a noob but I cannot understand this;

for ( variable = 1 ; variable < 100 ; variable += 1 )
{
  // some code

  if ( foofar )
    continue ;
  else
    sumfunc () ;
}

<endpre>

if i continue does the variable get added?


Parents
  • Ive been programing for nearly five months now so I am not a noob but I cannot understand this

    In that case, you should really try to get your hands on a copy of K&R (*). It will answer questions like yours, and many more, very quickly and correctly, since the book was actually written by the people who created C in the first place.

    From said book, on the continue statement: "[...]; in the for, control passes to the increment step.". The answer to your question is therefore "Yes.".

    (*) B. W. Kernighan, D. M. Ritchie; "The C programming language"

Reply
  • Ive been programing for nearly five months now so I am not a noob but I cannot understand this

    In that case, you should really try to get your hands on a copy of K&R (*). It will answer questions like yours, and many more, very quickly and correctly, since the book was actually written by the people who created C in the first place.

    From said book, on the continue statement: "[...]; in the for, control passes to the increment step.". The answer to your question is therefore "Yes.".

    (*) B. W. Kernighan, D. M. Ritchie; "The C programming language"

Children