Well you pass a copy of the pointer of your display to your function.
Then you create a new window and assign it's address to this copy of the pointer.
And then after the function returns you throw away this pointer.
You can hower pass a pointer to a pointer or a reference to a pointer.
Which is called like this
Not using one of these ways will merely pass a copy of the pointer.
This is not a problem unless you are trying to create a new display as this modifies the address the pointer points to.
I'm assuming you create the display inside of initializedisplay.
After calling this function display will still be null inside your main function.