Hi guys please would you help me figure out why this code is crashig
it says "Unhandled exception at 0x012e1569 in QuickS.exe: 0xC00000FD: Stack overflow."
QuickSort.txt document is on its right place.
#include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
void RecursiveQuickSort (unsigned long int * a, unsigned long int n,
unsigned long int m);
void main()
{
unsigned long int A[10000];
ifstream in("QuickSort.txt");
for (unsigned long int i = 0 ; i < 10001; i++)
{
in >> A[i];
}
RecursiveQuickSort (A, 0, 10001);
}
void RecursiveQuickSort (unsigned long int * a,unsigned long int n, unsigned long int m)
{
unsigned long int i = 0, h;
if (m - n == 1)
{
}
else
{
for (unsigned long int j = n + 1; j < m; j++)
{
if (a[n] > a[j])
{
i++;
h = a[n + i];
a[n + i] = a[ j ];
a[ j ] = h;
}
}
h = a[n];
a[n] = a[n + i];
a[n + i] = h;
RecursiveQuickSort(a, n, n + i );
RecursiveQuickSort(a, n + i + 1 , m );