I've made a set of prime numbers and I'm trying to find the prime numbers that make up the number inputted into the function (goldbach)
for reference, the partition is a vector that stores numbers that could be the primes that make up the inputted number, and the vector stores them in increasing order.
This code gives me a segmentation fault, so I'm wondering where I'm accessing bad memory.
Apologies for the pedantry, but just to correct the concepts here: The next element isn't NULL. The next element, partition.at(i+1), simply doesn't exist when we're at the final iteration. The .at() does bounds checking, which will throw an exception and avoid the undefined behavior associated with out-of-bounds array access.