Compiler threw a SIGSEGV at tmp = pow(p[i],j); while p[i] and j are two integers, and p[i] is a valid element of array p, I really don’t know why…
Original code is here:http://pastebin.com/DYhGeHxm
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Has it occurred to you that this:
may be pushing you either very near, or outright over the brink of your stack space? That is
bytes
I.e. you have a 19.08 megabyte stack space declaration. Consider dynamically allocating
aat least. When i changed it to be:and reran the code, it made it well past the seg-fault you have. unfortunately, it died at this location:
Both loops should break when you reach the allocated max size of
a[]. I did the following. At the top ofmain():Down in the loop:
This gets you past all the setup. The last thing is the quicksort algorithm itself, which appears broken as well. I highly advise starting with smaller data sizes to debug that.
Best of luck.
EDIT In case you needed a reference quicksort algorithm, i had one sitting in a source file in one of my junk folders. No guarantees its even right (pretty sure it is, and skips length-1 sorts too), but I know it doesn’t hang, so it has that going for it =P