-3

I'm analyzing a C program and i find this loop that i can't understand. There is no counter or limit or variable.

/* ioloop */
  for (;;)
  {
// statements

  }

is this an infinite loop ?

stojo304
  • 37
  • 12
  • 4
    Yes it is infinite loop.. Please always Google first before asking. – minigeek Feb 16 '17 at 15:49
  • Yes, it is (unless there is a `break` statement somewhere inside the loop). – rici Feb 16 '17 at 15:49
  • 1
    @rici: Or a `return`. – John Bode Feb 16 '17 at 15:50
  • @minigeek what's wrong with using stackoverflow not google ? it gives me always better and specific answers, can you explain me the issue of asking here ? – stojo304 Feb 16 '17 at 15:55
  • @stojo304 if you post low quality questions then your Account with IP gets banned... Like me :( hope you understand why this community is so strong. It keeps a valuable and non-redundant data so as to keep valuable info for future visitor.like you searched for this question...but already ans to this question existed..only thing i want to say is stackoverflow has an automatic algorithm of banning account and IP once your account gets low votes.or duplication.if you delete question thats even worst...i m suffering from it now..can answer only :/ gud luck... http://meta.stackexchange.com/q/86997 – minigeek Feb 16 '17 at 15:58
  • But you didn't use SO instead of google - asking a question that has been answered innumerable times is not the same as searching for that information, thereby cluttering SO with something that is fantastically easy to find. – KevinDTimm Feb 16 '17 at 16:07
  • @minigeek oh thanks for your advice :) – stojo304 Feb 16 '17 at 16:18

2 Answers2

1

It's an idiomatic way of writing a potentially infinite loop in C.

Alternatives such as while(1) often issued a compiler warning.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483
1

It is an infinite loop. Hopefully, there is a break statement in the loop somewhere. A break statement will cause the loop to exit.

Matt Spinks
  • 6,380
  • 3
  • 28
  • 47