Search code examples
ccommentsclion

Clion IDE comments my second part of code. What can I do?


Hi I am writing some code for finite automata but that is not important.

When I try to write in CLion my second part of the code is commented (from line 32 case JEDNORADKOVA). Do you know how can I repair my CLion or where is problem then?

My code:

#include <stdio.h>


typedef enum {START ,POSSIBLE_COMMENT, SINGLE_LINECOMMENT, MULTILINECOMMENT,MULTILINECOMMENT_MAYBE_END, QUOTATION_MARKS} tStates;

int main() {
  tStates state = START;
    printf("Delete of comments. Enter input \n");
    int sighn ;

    while((sighn=getchar())  != EOF)
    {
        switch (state) {
            case START:
                if (sighn == '/') {
                  state = POSSIBLE_COMMENT; }
                else{
                    putchar(sighn);
                }



            case SINGLE_LINECOMMENT:
                if (sighn == '\n')
                    state=  START;

                case MULTILINECOMMENT:
                 if (sighn == '*')

                break;



            case MULTILINECOMMENT_MAYBE_END:


            case QUOTATION_MARKS:


                break;
        }
    }
    return 0;
}

MY code in CLion

MY code in CLion

My code in VS Code

My code in VS Code


Solution

  • Read the messages in CLion: "Unreachable code :32" and the error is clear.

    I have formatted your source, but it seems to be not the one you have in CLion. Since the indenting and bracing are chaotic, I assume that you have a closing brace too much.