#include <iostream.h>

#include <math.h>

void determinePrimes(int);

inline bool isPrime(int, int*);

int main()

{

int maxPrime;

cin >> maxPrime;

determinePrimes(maxPrime);

cout << "Done.";

return 0;

}

void determinePrimes(int maxPrime)

{

int *primes = new int[1.1 * (maxPrime / log10(maxPrime))]; primes[0] = 2;

for (int j = 3; j <= maxPrime; j += 2)

if (isPrime(j, primes)) primes[j-3] = j;

delete[] primes;

}

inline bool isPrime(int number, int *primes)

{

for (int j = 0; primes[j] < sqrt(number); ++j)

if (number % primes[j] == 0) return 0;

return 1;

}

----

Why does this program crash? It's not making sense to me. I think I've deleted all my pointers and I think I'm not trying to access any arrays out of bounds...