   passing arguments . . loads of em
  i just built a function called set player . . ok ive realised that a player in my game is going to have loads of vlues set. ive built a function called set player and atm it takes 20 arguments , , making it look like(obviosly ive copied the int a to save time) void SetPlayer(int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a)Is there any way of making this look a bit neater or is this just the way it is?   
  void SetPlayer( const Player& rPlayer );?   ;  make struct which contains those values.struct player_arg{  int a;  int b;  int c;  ...};void SetPlayer(player_arg palyer);   ;  When a function signature has a lot of arguments I like to write it down like thisvoid SetPlayer(int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a, int a){  // ...};  Use a struct, or break the functions down into several areas of interest. That one function might get a bit crazy when you have to validate 20 inputs.SetPlayerLocation()SetPlayerInventory()SetPlayerGoldEXP()SetPlayerHealth()SetPlayerFromPlayer()The structs can also be hazardous to your sanity. The windows API used this approach and it can drive you insane. Everything you want to do requires several large structs to be filled out first.;Quote:Original post by DrPepperCorni just built a function called set player . . I strongly suspect that you could achieve the same with operator= and an appropriate constructor, instead.Quote:ok ive realised that a player in my game is going to have loads of vlues set. ive built a function called set player and atm it takes 20 argumentsIf values are related to each other, group them as objects. For instance, if you pass x and y positions separately, group them as 2D vectors instead. If values are just a bunch of various configuration details, use a configuration structure instead.   ;  Let's see a bit more code. What's a "player"? What does it mean to "set" a player?   