hello i am writing a program for matching << and >> pointers using a stack but somehow need this char < to be distinguished from < (the same character) so they can match on the stack....thinking I should put it in some sort of array but not sure how to do that any help appreciated...
If you are going to process the string at a character level, you need a state machine.
In State 0, if you see a '<', go to state 1.
In State 0, if you see a '>', go to state 2.
In State 1, if you see another '<', you've matched '<<', push and goto state 0.
In State 2, if you see another '>', you've matched '>>', pop and goto state 0.