C++ segfault, reproducible example
问题 Reposting with full code, as suggested from others. Just updated the main function with hard coded arguments that causes segmentation fault. Changing the width and height to something else lets the program run fine, for example 500 and 433 respectively. Main file: #include <cstdint> #include <iostream> #include <sstream> #include <vector> #include <cmath> #include "sierpinski.h" Triangle::Triangle() { this->pixels = nullptr; this->top = Coordinate(); this->left = Coordinate(); this->right =