I was thinking about it, and now think that representing unused array elements would be simpler using "blank" objects rather than NULLs.
To move a player from one team to another:
or, alternately you could simply swap the pointers if you know there's already a blank object at the destination:
This last snippet will also trade two players between two teams.
To move a player from one team to another:
delete p\league[1]\team[12]\player[18] p\league[1]\team[12]\player[18] = p\league[0]\team[0]\player[0] p\league[0]\team[0]\player[0] = new player ; update parent pointers p\league[0]\team[0]\player[0]\team = p\league[0]\team[0] p\league[1]\team[12]\player[18]\team = p\league[1]\team[12]
or, alternately you could simply swap the pointers if you know there's already a blank object at the destination:
temp.player = p\league[1]\team[12]\player[18] p\league[1]\team[12]\player[18] = p\league[0]\team[0]\player[0] p\league[0]\team[0]\player[0] = temp ; update parent pointers p\league[0]\team[0]\player[0]\team = p\league[0]\team[0] p\league[1]\team[12]\player[18]\team = p\league[1]\team[12]
This last snippet will also trade two players between two teams.