Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 5
    The most dangerous feature of this construct is that it starts with 9 instead of 10. The same is true for for (int x = 10; x-->0;). Commented Apr 18, 2024 at 7:45
  • 4
    @Sebastian: yes, for (int x = 10; x --> 0;) starts at 9 and iterates down to 0 included. This is a feature, not necessarily intuitive for everyone, but very handy to enumerate entries in an array where the initial value of x is the length of the array: for (size_t i = sizeof(a) / sizeof(a[0]); i --> 0;) { /* do something with a[i] */ } Commented Apr 18, 2024 at 8:08
  • 3
    I think, it's vald in many languages which have postfix --. THis is 40 year-old running joke. Every 2-3 years there is a question about it XD Commented Apr 26, 2024 at 7:35