Let me describe my problem. I want to create a list with a multitude of items. I am using a struct like this :
typedef struct Node{
char *element;
node *next;
node *prev;
}node;
Now, in my program I initialize a pointer as a pointer that points to such a struct :
temp = (node*)malloc(sizeof(node));
temp->element = (char*)malloc(sizeof(char)*maximum);
temp = InitElement(temp, maximum);
At first I give to my program that :
maximum = 10;
So far no problems. But my problem begins now : Edit/ Sigh. I'll try to make it simple :
I am making a list of elements that represent operands of an infix expression.
I am using my list as a Stack.
Each time my program detects an operand in the Initial Input of the user, it Pops the previous 2 nodes in order to combine them in an expression.
For example : If it detects '+' after having stored 234 and 2 then it will pop the previous 2 nodes, create a new node which will be (234+2) and push it back.
Now for my problem. I need my max size of the string to be strictly 10 unless it is a parenthesis, a full operation as an element. That is what I need to change in my program. But I also need it to return to how it was initially afterwards. How can I do it WITHOUT affecting any existing node on the list via temp with the size increase?