Update: programme crashes when retured pointer is provided to a variable in the main programm