I am implementing a stack and I would like to push and pop string data. can I not just set
string name = originalString ???
here is what I have for push:
void push(StackNode** top_ref, int nAttack, int nDefense, string nName, string nType) {
StackNode* stackNode = (StackNode*)malloc(sizeof(StackNode));
stackNode->attack = nAttack;
stackNode->defense = nDefense;
stackNode->name = nName; //not working
stackNode->type = nType; //not working
stackNode->next = NULL;
stackNode->next = *top_ref;
*top_ref = stackNode;
}
where stackNode->name
and stackNode->type is already defind as a string
I keep getting: "Error reading characters of string."