“是什么意思” #define 1000 a“用C语言 [英] What is the meaning of " #define 1000 a" in C language

查看:104
本文介绍了“是什么意思” #define 1000 a“用C语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上面定义的宏的价值是多少



我尝试过的事情:



我没有得到任何结果,请帮我

what is the value of that macro defined above

What I have tried:

I didn't get any result, Please help me

推荐答案

该语句无效,你不能改变常量的定义。我怀疑你的意思是:

That statement is invalid, you cannot change the definition of a constant. I suspect you mean:
#define a 1000

// now anywhere the compiler sees a it will replace it with 1000.
//
// e.g.

printf("The value of a is %d\n", a);

// will print
//    The value of a is 1000


#define是一个预处理器宏,例如



#define is a preprocessor macro, e.g.

#define a 1000





现在你可以使用a而不是1000.

在你的问题中你使用它错了,编译器打印错误E0040预期标识符。



Now you can use "a" instead of 1000.
In your question you use it wrong, the compiler prints error E0040 "expected an identifier".


这篇关于“是什么意思” #define 1000 a“用C语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆