I know in C++ that you can declare on variables inside the FOR, e.g:
for(int i=0; i<10; i++)
is there any way to declare another variables inside the for? this won't work for me:
for(int i=0, char Ch='J'; i<10; i++)
You could use a std::pair
:
for (std::pair<int, char> p(0, 'j'); p.first < 10; p.first++)
{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With