So I have a stack of char*. Essentially I want to pop off that stack and concatenate it into one long string separated by a "/" and return it. However I dont know how to do this properly.
I am trying to do this in C. So for my code its something like this. Stacksize returns the size of the stack. Apologies if its bad, I really dont have a clue....
struct stack* test = new_stack();
struct stacknode = test->head;
char* output = (char*)malloc(sizeof(char) * stacksize(test));
while(stacknode != NULL){
strcat(output, stacknode->name);
stacknode = stacknode->nextNode;
}
return output;
Any help is greatly appreciated. Thanks