Originally Posted by
algorism
You're missing an srand(time(NULL)) call early in main. Without it you will always get the same sequence of random numbers from rand().
And it's probably not sorting correctly since your quicksort has bugs. You need a testing routine to check if the array has been properly sorted.
Bugs in your quicksort:
* if first is not less than last, i will be used uninitialized in the while condition.
* the swapping of the pivot and the recursive calls should be AFTER the while loop (not in it).
(The normal name for your 'swap' variable is 'pivot'.)