|
-
November 11th, 2009, 07:45 PM
#1
Switch Statement, varables' value changes
Below is a switch statement, with the conditional varable ,*strItr, being an iterator to a string.
My problem is that when I enter a case, I'm able to create a Node, Node*, and have Node* point to &Node.
I'm able to successfully push the Node* in the nodePtrStack.
The nodePtrStack is declaraed outside of the for loop.
A reference to the element Node* in the stack is visible during debugging.
But when I break from case, the stack resets itself. The element Node* disappears and the stack is now empty, what Im I doing wrong?
I've been searching online but with no success.
thanks for any suggestion.
Code:
for(strItr = userPostfix.begin(); strItr != userPostfix.end(); strItr++)
{
switch(*strItr){
case 'T':
case 't':
{
Node<string>truVar("T", NULL, NULL);
Node<string>* ptruVar = &truVar;
nodePtrStack.push(ptruVar);
break;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|