drl 规则语言 语法

C language syntax specify rules for sequence of characters to be written in C language. In simple language it states how to form statements in a C language program - How should the line of code start, how it should end, where to use double quotes, where to use curly brackets etc.

C语言语法指定了要用C语言编写的字符序列的规则。 用简单的语言说明了如何在C语言程序中形成语句-代码行应如何开始,代码行应如何结束,在何处使用双引号,在何处使用大括号等。

The rule specify how the character sequence will be grouped together, to form tokens. A smallest individual unit in C program is known as C Token. Tokens are either keywords, identifiers, constants, variables or any symbol which has some meaning in C language. A C program can also be called as a collection of various tokens.

该规则指定如何将字符序列分组在一起以形成标记 。 C程序中最小的单个单元称为C令牌 。 令牌可以是关键字,标识符,常量,变量或任何在C语言中具有一定含义的符号。 AC程序也可以称为各种令牌的集合。

In the following program,

在以下程序中

#includeint main()
{printf("Hello,World");return 0;
}

if we take any one statement:

如果我们采取任何一项陈述:

printf("Hello,World");

Then the tokens in this statement are→ printf, (, "Hello,World", ) and ;.

然后,此语句中的标记为→ printf("Hello,World");

So C tokens are basically the building blocks of a C program.

因此,C令牌基本上是C程序的构建块。

分号; (Semicolon ;)

Semicolon ; is used to mark the end of a statement and beginning of another statement. Absence of semicolon at the end of any statement, will mislead the compiler to think that this statement is not yet finished and it will add the next consecutive statement after it, which may lead to compilation(syntax) error.

分号; 用于标记一条语句的结尾和另一条语句的开头。 在任何语句的末尾缺少分号,将使编译器误认为该语句尚未完成,并且将在其后添加下一个连续的语句,这可能导致编译(语法)错误。

#includeint main()
{printf("Hello,World")return 0;
}

In the above program, we have omitted the semicolon from the printf("...") statement, hence the compiler will think that starting from printf uptill the semicolon after return 0 statement, is a single statement and this will lead to compilation error.

在上面的程序中,我们从printf("...")语句中省略了分号,因此编译器会认为从printf开始直到return 0语句后再分号是一个单独的语句,这将导致编译错误。

注释 (Comments)

Comments are plain simple text in a C program that are not compiled by the compiler. We write comments for better understanding of the program. Though writing comments is not compulsory, but it is recommended to make your program more descriptive. It make the code more readable.

注释是C程序中未经编译器编译的纯文本。 我们编写注释以更好地理解该程序。 尽管写注释不是强制性的,但是建议使程序更具描述性。 它使代码更具可读性。

There are two ways in which we can write comments.

我们可以通过两种方式编写评论。

  1. Using // This is used to write a single line comment.

    使用//这用于编写单行注释。

  2. Using /* */: The statements enclosed within /* and */ , are used to write multi-line comments.

    使用/* *//**/内的语句用于编写多行注释。

Example of comments :

评论示例:

// This is a comment/* This is a comment *//* This is a long
and valid comment */// this is nota valid comment

C程序的一些基本语法规则 (Some basic syntax rule for C program)

  • C is a case sensitive language so all C instructions must be written in lower case letter.

    C是区分大小写的语言,因此所有C指令必须使用小写字母书写。

  • All C statement must end with a semicolon.

    所有C语句必须以分号结尾。

  • Whitespace is used in C to describe blanks and tabs.

    C语言中使用空格来描述空格和制表符。

  • Whitespace is required between keywords and identifiers. We will learn about keywords and identifiers in the next tutorial.

    关键字和标识符之间必须有空格。 在下一个教程中,我们将学习关键字和标识符。

翻译自: https://www.studytonight.com/c/c-syntax.php

drl 规则语言 语法

drl 规则语言 语法_C语言基本语法规则相关推荐

  1. c语言是静态语言python语言是脚本语言吗_C语言还是Python语言哪个更好?

    最近,很多人问我问题. C语言还是Python,哪个更好?实际上,没有什么好坏之分,而且由于Python的基本逻辑是用C语言实现的,因此它们都有自己的特点.如果您想了解更多信息,建议您先学习C语言,然 ...

  2. 棱形旋转c语言程序_C 语言时隔 5 年重回巅峰,这 20 个热门项目拿去练手!

    在上个月的 TIOBE 编程语言排名中,C 语言和 Java 的差距只有 0.01%.在近日 TIOBE 公布的 2020 年 5 月编程语言排行榜中,C 语言成功超越了 Java,重返第一的王者宝座 ...

  3. 蜂鸣器发出7种音阶c语言程序_C语言编程新思路

    第一章 单元测试 1.单选题: 关于一个C语言程序执行的起点和终点,以下选项正确的是 ( ). 选项: A: main 任意 B: main 最后一个 C: main main D: 第一个 最后一个 ...

  4. c语言 指针_C语言——指针

    学习阶段:高中信竞.大学编程. 前置知识:二进制与十六进制,C语言基础,数组. 指针初学可能比较难理解,我这篇文章尽量用通俗易懂的方式来讲解. 1. 指针概述 为什么有指针这个东西?因为指针很贴近计算 ...

  5. c语言 指针_C 语言指针详解

    (给CPP开发者加星标,提升C/C++技能) 作者:C语言与CPP编程 / 自成一派123(本文来自作者投稿) 1为什么使用指针 假如我们定义了 char a='A' ,当需要使用 'A' 时,除了直 ...

  6. aes算法c语言实现_C语言实现常用数据结构:Dijkstra最短路径算法(第18篇)

    「今天是学习C语言第 161 天」 纸上学来终觉浅,绝知此事要躬行.-- 陆游「冬夜读书示子聿」#题外话算法学习重点是学习如何编程使用它. # Dijkstra算法 Dijkstra算法,中文译名迪杰 ...

  7. c++枚举和c语言枚举_C语言枚举初学者指南

    c++枚举和c语言枚举 Hey, folks! Hope you all are doing well. In this article, we will be discussing Enumerat ...

  8. c语言 落后_C语言与Java,你会选择哪个?C语言并没有落后!

    原标题:C语言与Java,你会选择哪个?C语言并没有落后! C语言与Java,你会选择哪个?C语言并没有落后! C语言与Java,是软件开发的两大编程语言(所有的编程语言都有许多的共同特性,唯一的区别 ...

  9. 第六章 C语言数组_C语言变长数组:使用变量指明数组的长度

    在<C语言的三套标准:C89.C99和C11>一节中我们讲到,目前经常使用的C语言有三个版本,分别是 C89.C99 和 C11.C89(也称 ANSI C)是较早的版本,也是最经典的版本 ...

最新文章

  1. Weblogic 前端热部署
  2. (转载)android如何在style文件中使用自定义属性
  3. 强化学习(十二) Dueling DQN
  4. boost::python::detail::copy_ctor_mutates_rhs相关的测试程序
  5. 200721学习日报
  6. matlab中显示ycbcr图像,rgb到matlab中的ycbcr转换
  7. 验证测试线时为什么会出现“正损耗”?
  8. python自动化运维快速入门pdf下载_Python自动化运维快速入门
  9. 关于Windows azure从github上部署项目
  10. kubernetes不同的命名空间下的容器能通信吗_在Kubernetes环境中,容器间如何进行网络通信?...
  11. python中的类及self详解_python中的self详解与对照与网站分享
  12. 一步一步使用标c编写跨平台图像处理库
  13. ARM编译中的RO、RW和ZI DATA区段[转]
  14. jstat命令查看jvm的GC情况
  15. 计算机无法共享的原因,文件夹无法共享的原因及其解决办法
  16. Linux内核5.10编译 与调试
  17. Java中%是什么意思?
  18. H3C交换机密码加密解密
  19. 【渝粤教育】广东开放大学 工程力学 形成性考核 (27)
  20. 烧脑电影:彗星来的那一夜(Coherence)

热门文章

  1. Hibernate5的学习笔记(二)
  2. QPE(量子相位估计)
  3. Numpy:数组对象(Ndarray)的属性
  4. 同一个机器 安装多个版本Chrome浏览器的方法
  5. 前端面试题,前端组件化、工程化、模块化的概念
  6. 科大奥瑞物理实验——光纤传感器实验
  7. WIN10 登录samba服务器提示秘密不正确
  8. HIVE:窗口函数,用sql语句查询MySQL安装路径和版本
  9. 动物视觉感知进化的一些看法
  10. 自古猛兽皆独行,唯有牛羊结成群