Hello everybody.
I am new in C programming language and have an (if satament) and need to transfer it into switch statment.
My problem is that I have a field named (node_kind) of char* type and I compare it's content in the if statment using (strcmp) but I don't know how to do that in the switch statment.
Would you plz tell me how ?
Here is a short quote of my program
I am new in C programming language and have an (if satament) and need to transfer it into switch statment.
My problem is that I have a field named (node_kind) of char* type and I compare it's content in the if statment using (strcmp) but I don't know how to do that in the switch statment.
Would you plz tell me how ?
Here is a short quote of my program
Code:
if (strcmp(node->node_kind, "VAR_TOKEN_e") == 0)
job = visitor->visitjob_VAR_TOKEN;
if (strcmp(node->node_kind, "INT_e") == 0)
job = visitor->visitjob_int;
if (strcmp(node->node_kind, "BOOL_e") == 0)
job = visitor->visitjob_bool;
Comment