I'm having some trouble with dynamic memory allocation of a struct. The struct looks like this:
struct J
{
int w;
int s;
};
During the execution of the program, the following line of code results in a crash, which when debugging was because of std::bad_alloc, which does not make any sense to me.
J* x = new J;
Any idea why this would cause a crash? It's just a simple dynamic allocation of a struct but in my program whenever it reaches that line the program crashes and shuts down.