updating pointer with a function

Please post enough code so that it actually compiles.