[vox-tech] loop never exits!

Matthew Van Gundy matt-lugod at shekinahstudios.com
Wed Apr 21 19:20:26 PDT 2010


On 4/21/10 3:26 PM, Jeff Newmiller wrote:
>> There are many ways to skin a cat, here's one:
>>
>> void reverse(int forward[], int backward[], unsigned int n) {
>>    unsigned i = n;
>>    while(i-->  0) {
>>      backward[n-i-1] = forward[i];
>>    }
>> }
>
> This reverses and then re-reverses it.

Nope, just reverses it once.  I'll admit, it isn't an idiomatic 
construction, but it uses an unsigned index that counts down to reverse 
an array since that's what Brian seemed to be after.


More information about the vox-tech mailing list