Alot of strange things going on in your code, well your getting that error because you can''t specifiy the size of a statically allocated array with a non constant variable in this case the variable "cardsinHand".
You''ve declared a local variable "j", don''t assign any values to it and your trying to you use as a loop control variable so when your doing "tempHand[j] = hand[j];" in that loop(s) your just re-assigning the same value in the same element of hand to the same element of tempHand what ever the value of j is initialzied to.
Also you declared the data member "hand" to be of type pointer to char but then your assign an instance of type Card. You should also post your Card type.
Another thing your using C++ but your including C style headers you should change it from "#include <string.h>" to "#include <cstring> but you might be better off using standard library string instead of arrays of characters.
Its really hard to tell what your trying to achieve in that function and i think your making it more complicated than it really is. By the looks of things you want a container of Cards and from looking at "addCard" method it looks like you''ll want a list of Cards. I would change it to something like this:
#include "Card.hpp"#include <string>#include <list>class Player {public: Player(); Player(const std::string&, const std::string&); Player(const Player&); //copy-constructor Player& operator=(const Player&); //asignment ops const bool addCard(const Card& theCard); const bool removeCard(int index); const Card& showHand() const; Card& showHand(); const Card& showCard() const; Card& showCard(); void addTrick(); int getTricks(); const std::string& getName() const; std::string& getName(); void setName(const std::string& theName); const std::string& getTeam() const; std::string& getTeam(); void setTeam(const std::string& theTeam);private: std::string name, team; std::list<Card> hand; int tricks; int cardsinHand;};
then that function would be something like:
const bool addCard(const Card& theCard) { //... do something hand.push_back(theCard); return true;}