compiles without errors runs with seg fault 11