Last Updated: February 25, 2016
·
447
· carlosnasillo

Fun quirk: You can declare Classes/Functions within 'for' loops in C++

Not only can variables be declared in the init part of a for loop, but also classes and functions.

for(struct { int a; int b; } loop = { 1, 2 }; ..; ..) 
{
    ...
}

That allows for multiple variables of differing types. Fun, yet I would personally try to avoid doing anything like that!