Question: Why am I getting a segmentation fault in the following code?

```
    struct Cell
    {
        cellMode mode;
        bool visited;
        //bool scanned;
        int rowIndex;
        int colIndex;
        Cell *neighbours;//if using Cell neighbours[3] i am getting a compilation error

        Cell()
        {
            neighbours = new Cell[3];//seg fault here
        }
    };

```

When I use a static array, I get the following error

`neighbours has incomplete type`

Answer: 
If you `new` 3 `Cell`s in `Cell`'s constructor you are calling 3 more `Cell`'s constructors. Each of those 3 then calls 3 more, and so on. Until, a... wait for it... stack overflow. Hurrah. It's infinite.
Since the constructor is calling itself three times per instance, you are basically creating an infinite loop due to never-ending recursion. That's where your problem is.