If this is it, your approach is not so much wrong. You should consider swapping the loops. You won't need any indexing then.
BTW: Is this homework?
In reply to Re: matching an array
by Skeeve
in thread matching an array
by Anonymous2003
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |