0
Is there a way to use void pointers to make a function that can have any structure parameters ?
Imagine that I have a Player structure and Enemy structure Both have a x, y, vx and v variable I make a move function that add the vx to x and add vy to y It is possible to use void pointers to move both Player instance and Enemy instance if I pass them by reference ?
2 Respostas
0
If you created a global function like this:
void MoveSprite(Player *p, Enemy *e, int vx, int vy) {...}
then you can update both instances in one function.
Maybe it's better to post a part of the code to show this case. 🤔