Ordering an array of negatives, zero and positives integers with one iteration Take an array of integers containing negative numbers, positive numbers and zeros. Group it with one iteration and in place such that all of the negative numbers come first, followed by all of the zeros, followed by all of the positive numbers.

Example:

Input:  5, 3, 0, -6, 2, 0, 5
Output: -6, 0, 0, 3, 2, 5, 5


Note that the numbers do not need to be fully sorted: just sorted by sign.

So, the final array will look like this: -, -, ..., -, -, 0, 0, ..., 0, 0, +, +, ..., +, +

Rules


You may only use the input array and a constant amount of additional memory (i.e. you may not create any more arrays)
You may only use one loop, which may execute only as many times as the length of the array. You may not use built-in functions which conceal any kind of loop. This includes built-in sort functions.
The result should be in the format I described


The winner will be the person who will submit the shortest code (counted in bytes) that changes the initial array into a correct format (like described above).
C, 92
This could probably be reduced by at least 10 bytes; there are many expressions going to waste.
The first argument should point to the beginning of the array; the second should point after the end of the array.
*x;f(b,e)int*b,*e;{for(x=b;x&lt;e;x++)*x&gt;0&amp;&amp;--e-x?*x--^=*e^=*x^=*e:*x&lt;0?b-x?*x^=*b=*x:0,b++:0;}

Ungolfed with random test generator:
*x;
f(b,e)int*b,*e;{
    for(x=b;x&lt;e;x++) {
        if(*x&lt;0) {
            if(b == x)
                b++;
            else
                *b++ = *x, *x=0;
        } else if(*x&gt;0 &amp;&amp; x != --e) {
            *x^=*e^=*x^=*e;
            x--;
        }
    }
}

int main()
{
    int a[999];
    srand(time(0));
    int n = rand() % 50;
    int i;
    for(i = 0; i &lt; n; i++) printf(&quot;%d &quot;, a[i] = rand() % 9 - 4);
    f(a, a+n);
    puts(&quot;&quot;);
    for(i = 0; i &lt; n; i++) printf(&quot;%d &quot;, a[i]);
    return 0;
}