警告:赋值从指针生成整数而不进行强制转换[默认启用]

时间:2017-07-06 19:26:26

标签: c pointers casting warnings

有一个警告,我无法从此代码中删除它。这是我可以提供的代码:

%{
#include <stdlib.h>
#include <stdio.h>
#include "y.tab.h"
%}

%%

[1-9]+          {
                        yylval.iVal = atoi(yytext);
                        printf("NUMBER\n");
                        return NUMBER;
                }
[a-z]           {
                        printf("VARIABLE\n");
                        yylval.cVal = yytext;
                        return VARIABLE;
                }
[-()<>=+/*\n]   {
                        printf("OPERATOR\n");
                        return *yytext;
                 }
"^"             {
                        printf("POW\n");
                        return *yytext;
                }
[ \t]+          ;      // Skip whitespaces.
.               yyerror("Unknown character.\n");

%%

int yywrap(void)
{
     return 1;
}

我收到了警告:yylval.cVal = yytext;。怎么会出错?提前谢谢。

0 个答案:

没有答案