前C'='令牌预计前pression [英] Expected expression before '=' token in C
本文介绍了前C'='令牌预计前pression的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
虽然pre处理器分配I = 3.14159265。当我编译它,给出了一个错误,说之前预计'='令牌什么,为什么是一个前pression?
的#include<&stdio.h中GT;#定义PI = 3.14159265
诠释的main()
{
浮动我;
I = PI;
的printf(我的第一个Linux程序\\ n);
返回0;
}
解决方案
的#define PI = 3.14159265
定义PI为 = 3.14159265
字面上包括等号。因此, I = PI;
是一样的:
I = = 3.14159265;
这显然将无法编译。为了解决这个问题,从你的PI的定义删除 =
:
的#define PI 3.14159265
Though the pre processor assigns i = 3.14159265. When i compile it, gives an error saying expected an expression before '=' token what and why is that ?
#include <stdio.h>
#define PI = 3.14159265
int main()
{
float i;
i = PI;
printf("My first Linux program\n");
return 0;
}
解决方案
#define PI = 3.14159265
defines PI to be = 3.14159265
literally including the equals sign. Thus i = PI;
is the same as:
i = = 3.14159265;
which clearly won't compile. To fix it, remove the =
from your definition of PI:
#define PI 3.14159265
这篇关于前C'='令牌预计前pression的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文