Really fucking random. They happen whenever we access illegal memory — so a good way to debug when we find segfaults is to think about where we might access memory or variables that might not exist.

Mental checklist

  • Are you accessing array elements that exist?