# Problem of understanding recursion

• 05-02-2004
ixing
Problem of understanding recursion
Hello. Need despereately help with this simple program.Tried to compile it with bcc32 and VC++ 6 but none of them gives me the .exe file.Doesnt recognize the Quicksort function.It says that has no prototype in function main and in function Quicksort itself.Please can somebody tell me where is the mistake?
Code:

```#include <stdio.h> #include <stdlib.h> #include <dos.h>                                            #include <sys\timeb.h> #define Arraysize  10 void QuickSort (int a[Arraysize],long int left, long int right); int main(void) { int t; int B[Arraysize]; srand(time(NULL)); for (t=0; t<Arraysize; t++) { B[t] = rand () * Arraysize / (RAND_MAX + 1); printf("seed is %d\n r.number is %d\t\t",B[t]); } printf("Start partition\n"); Quicksort(B,0,Arraysize); for (t=0; t<Arraysize; t++) { printf("array coming"); printf(" %d\t\t", B[t]); } return 0; } void QuickSort (int a[Arraysize],long int left, long int right) { long int i,j,x,h; i=left; j=right; srand(time(NULL)); x=a[rand() * Arraysize / (RAND_MAX +1)]; while (i<=j) { while (a[i]<x) { i++;} while (a[j]>x) {  j--;} if (i<=j) { h=a[i]; a[i]=a[j]; a[j]=h;} } if (left<j) {  Quicksort (a,left, j);}        if (i<right) { Quicksort (a,i,right);}      return; }```
• 05-02-2004
MrWizard
You're calling Quicksort in your code, not QuickSort.

Also, only seed the random number generator at the start of the program.
• 05-02-2004
ixing
Thanks
:)) Damn I was looking for the mistake everywhere and I never spotted it. :)) Thanks a lot again.