Here is the implementation I ended up with. Please post your feedback!
#include <cstdio>
#include <cstdlib>
#include <iostream>
inline void swap(int * const a, const int i, const int j) {
const int tmp = a[i];
a[i] = a[j];
a[j] = tmp;
}
void printArray(int *a, int len) {
for(int i=0; i<len; i++)
printf("%i ", a[i]);
printf("\n");
}
void qsort(int * const a, const int len) {
if(len < 2)
return;
const int pivot = a[rand() % len];
printf("Choosed pivot %i\n", pivot);
int lower = 0;
int upper = len - 1;
while(true) {
while(a[lower] < pivot)
lower++;
while(a[upper] > pivot)
upper--;
printArray(a, len);
if(lower == upper)
break;
swap(a, lower, upper);
}
printf("First Part ");
printArray(a, lower);
printf("Second Part ");
printArray(a + lower + 1, len - lower - 1);
printf("\n");
qsort(a, lower);
qsort(a + lower + 1, len - lower - 1);
}
int main() {
int a[] = {1, 7, 3, 6, 5, 9, 2, 0, 4, 8};
int len = sizeof(a)/sizeof(int);
qsort(a, len);
printArray(a, len);
std::cin.get();
}