Hi. This should be very easy for you guys, but I still can't get it visualized in my mind. Here's what I'm trying to do:
if (flag)
for (i = 0; i < 10; i++)
{LARGE_BLOCK_OF_CODE (that visits an array in order)}
else
for (i = 9; i >= 0; i--)
{LARGE_BLOCK_OF_CODE (that visits an array in REVERSE order)}
The problem is that this block of code cannot be placed in a function, and I don't want to copy/paste it twice. Is there any way I can do that in this manner:
if (flag)
loop = for (i = 0; i < 10; i++);
else
for (i = 9; i >= 0; i--);
loop
{LARGE_BLOCK_OF_CODE (that visits an array in the order specified in 'loop')}
??
Thanks.