为什么#定义不需要分号? [英] Why does #define not require a semicolon?

查看:154
本文介绍了为什么#定义不需要分号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一些测试code中的 C 。错误我已经插入了一个; 的#define ,这给了我的错误。为什么不要求的#define S'

I was writing some test code in C. By mistake I had inserted a ; after a #define, which gave me errors. Why is a semicolon not required for #defines?

推荐答案

的#define 是的 preprocessor指令,不是的语句声明的由C语法定义(这两个都要求以分号结束)。对于每一个的语法规则是不同的。

#define is a preprocessor directive, not a statement or declaration as defined by the C grammar (both of those are required to end with a semicolon). The rules for the syntax of each one are different.

这篇关于为什么#定义不需要分号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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