[Solved] Pointer will randomly print it’s address instead of it’s pointed value, C++
void setvalores(int vi, int fu, int ve) { velocidad = &ve; vida = &vi; fuerza = &fu; }; The pointers to vi, fu, and ve get invalidated when the function returns. You’re not seeing addresses being printed, but simply garbage. Your entire design doesn’t and shouldn’t need to use pointers though. 8 solved Pointer will … Read more