So I'm trying to write a code that deletes all comments from a giving code. When giving my code a condition to check if the current char is '*' and the next one is '/' (end of comment) and try to run it, it accepts ./ as */.
The code looks something like that:
char line[MAX_LINE_LEN] = { 0 };
...Input and some code...
  for (int index = 0; index < MAX_LINE_LEN - 1 && line[index] != '\0';
            index++)
    {
        if (line[index] == '/' && line[index + 1] == '/'
                && comment_nest == 0)
            break;
        if (line[index == '/'] && line[index + 1] == '*')
            comment_nest++;
        if (line[index == '*'] && line[index + 1] == '/')
            comment_nest--;
        if (comment_nest == 0)
            cout << line[index];
    }
so i keep getting "comment_nest--" when the input contains ./
Any help would be appreciated. Thanks.
 
    