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!
Written by Carlos Nasillo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#C
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#