'How do you compare 2 strings in Yacc/Bison?

We are asked to use FLEX software and gotta write the code in C. First string is Collected from a text file, this is how I did it in LEX:

%option noyywrap yylineno
%{
    #define YYSTYPE char *
    #include "y.tab.h"
%}
%%
[ \t\n]+ {}
"NAZIV" {return _NAZIV;}
"GODINA" {return _GODINA;}
"TIP" {return _TIP;}
"ECTS" {return _ECTS;}
":" {return _DVOTACKA;}
";" {return _SEMICOLON;}
[A-Za-z]+  {yylval=strdup(yytext); return _VRIJEDNOST;}
[0-9]+   {yylval =atoi(yytext); return _BROJ_BODOVA;}

So I need to collect a whatever string [A-Za-z]+ in second to last line. Now in Yacc I need to increase a counter if the text file says "obavezni" at that spot. I did it like so when encountering the spot in text file:

: _TIP _DVOTACKA _VRIJEDNOST _SEMICOLON
{result=strcmp($3,string);if(result==0) prvi_uslov=1; }
;

string from up there is char string[]="obavezni"; This way I get a bunch of warnings about not being able to compare const * char and *char and that one of the arguments is of type YYSTYPE. I started doing Yacc/Bison yesterday and I have no idea what this means, I just need a simple way to compare a collected value from text file to an existing string, and if they are same counter goes up. That's all. Thanks to all kind souls willing to help



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source