When you hit a *
in comment state, you read the next character to see if it's a /
. This consumes that character, so it won't be checked on the next iteration.
So:
/* **/
12
sees the *
at 1, reads the *
at 2, stays in comment mode, and continue
s with the /
. Whereas:
/* ***/
123
sees the *
at 2, reads the *
at 2, continues, then reads the *
at 3 and finds a /
following and drops out of comment mode.