Quote Originally Posted by algorism View Post
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'.)
Yes I managed to find all of that out, remembered to use -Wall while compiling, and also noticed I never called srand which I added in to my populate function. The quicksort bugs did take me a little bit of time but after looking up examples I noticed my mistake and fixed that. It is printing out correctly now and sorting. Thank you for the help!