Common reasons for program crashes (C++)

1. Illegal memory access

int main()
{
  int* ptr;
  int num = ptr[0];
}
int main()
{
  int* ptr = new int(42);
  delete ptr;
  delete ptr;
}
int main()
{
  int ary[5];
  ary[5] = 42;
}

2. Allocating to much memory

int main()
{
  for(;;)
  {
    int* ptr = new int[1000000000];
  }
}
int main()
{
  int ary[1000000000];
  ary[0] = 42;
}
void fct()
{
  fct();
}

int main()
{
  fct();
}

3. Unsolved error handling

#include <assert.h> 

int main()
{
  int* ptr = nullptr;
  assert(ptr);
}
#include <exception>

int main()
{
  throw std::exception();
}