[Solved] C Program to count comment lines (// and /* */)
You can write a state machine that should handle most cases. As you scan the file, you’ll be in one of the following states: TEXT – regular (non-commented) text; this is the state you’ll start in. Any newline seen in this state will cause the total-lines counter to be incremented. SAW_SLASH – You’ve seen a … Read more