c语言规范标准中英文,C语言中英文翻译资料.doc

253b171540df25e1b84436cbe50dfc72.gifC语言中英文翻译资料.doc

The C Programming LanguageC is a high-level programming language developed by Dennis Ritchie and Brian Kernighan at Bell Labs in the mid-1970s. Although originally designed as a systems programming language, C has proved to be a powerful and flexible language that can be used for a variety of applications, from business programs to engineering. C is a particularly popular language for personal computer programmers because it is relatively small-it requires less memory than other languages.The first major program written in C was the UNIX operating system; and for many years, C was considered to be inextricably linked with UNIX. Now, however, C is am important language independent of UNIX. Although it is a high-level languages, C is much closer to assembly language than are most other high-level languages. This closeness to the underlying machine language allows C programmers to write very efficient code. The how-level nature of C, however, can make the language difficult to use for some types of applications.Now lets take an overview of the C programming language, both historically and technically and technically.As a general-purpose programming language, C has been closely associated with UNIX system where it was developed, since both the system and most of the applications that run on it are written in C. The language , however, is not tied to any one operating system or machine; and although it has been called a “system programming language” because it is useful for writing compilers and operating systems, it has been used equally well to write major programs in various fields.Many of the important ideas stem from the language BCPL, developed by Martin Richards. The influence of BCPL on C proceeded indirectly through the language B, which was written by Ken Tompson in 1970 for the first UNIX system on the DEC-PDP-7.BCPL and B are “typeless” languages. By contrast, C provides a variety of data types. The fundamental types are characters, and integers and floating point numbers of several sizes. Additionally, there is a hierarchy of derived data types created with pointers, arrays, structures, and unions. Expressions are ed from operands; any expression, including an assignment or a function call, can be a statement. Pointers provide for machine-independent address arithmetic. C provides the fundamental control-flow constructions required for well-structured programs statement grouping, decision making if-else , selecting one of a set of possible cases switch, looping with the termination test at the top while, for or at the bottom do, and early loop exit break.Functions may return values of basic type, structures, unions, or pointers. Any function may be called recursively. Local variables are typically “automatic”, or created anew with each invocation. Function definitions may not be nested but variables may be declared in a block-structured fashion. The functions of a C program may exist in separate source files that are compiled individually. Variables may be internal to a function, external but known only within a single source files, or visible to the entire program.A preprocessing step pers macro substitution on program text, inclusion of other source file, and conditional compilation. C is a relatively low-level language, meaning that C deals with the same sort of objects that most computers do, namely characters, numbers, and addresses. These may be combined and moved about with the arithmetic and logical operators implemented by real machines.C provides no operations to deal directly with composeite objects such as character strings, sets, lists, or arrays. There are no operations that manipulate an entire any storage allocation facility other than static definition and the stack discipline provided by the local variables of functions; there are no heap or garbage collection . Finally, C itself provides no /output facilities; there are no Read or Write statements, and no built-in file access s. All of these higher-level mechanisms must be provided by explicitly-called functions. Most C implementations have included a reasonably standard collection of such functions.Similarly, C offers only straightforward, single-thread control flow tests, loops, grouping, and subprograms, but not multiprogramming, parallel operations, synchronization, or co-routines.Although the absence of some of these features may seem like a grave deficiency, keeping the language down to modest size has real benefits. Since C is relatively small, it can be described in a small space, and learned quickly. A programmer can reasonably expect to know and understand and indeed regularly use the entire language.In 1983, the American National Standard Institute ANSI established a committee to provide a modern, comprehensive definition of C. The resulting definition, the ANSI standard, or “ANSI C”, was completed late in 1988. Most of the features of the standard are already supported by modern compilers . The standard is based on the original C reference manual. The language is relatively little changed; one of the goals of the standard was to make sure that most existing programs would remain valid, or, failing that, that compilers could produce warning of new behavior.For most programmers, the most important change is a new syntax for declaring and defining functions. A function declaration can now include a description of the arguments of the function; the definition syntax changes to match. This extra ination makes it much easier for compiler to detect errors caused by mismatched arguments. This has proved to be a very useful addition to the language.A second significant contribution of the standard is the definition of a library to accompany C. It specifies functions for accessing the operating system for example, to read and write file, atted and output, memory allocation, string manipulation, and the like. A collection of standard headers provides uni access to declarations of functions and data types. Programs that use this library is closely modeled on the “standard I/O library” of the UNIX system.Although C matches the capability of many computers, it is independent of any particular machine architecture. With a little care it is easy to write portable programs, that is, programs that can be run without change on a variety of hardware.C, however, like any other language, has its blemishes. Some of the operators have the wrong precedence; some parts of the syntax could be better. Nonetheless, C has proved to be an extremely effective and expressive language for a wide variety of programming applications.Having reviewed the history and features of C, lets now study an example C program for a basic understanding of what a C program looks like. The following program finds the factorial of the number 6./* Program to find factorial of 6 */ include stdio.h define3 VALUE 6 int i, j ;main j1;for i1; iVALUE; i jj*I;printf “The factorial of d is dn”, VALUE, j ;As shown in the example, C code starts with include stdio.h , which instructs the compiler to include the standard I/O library into your program so that you can read and write values, handle text files, and so on. C has a large number of standard libraries like stdio, including string, time and math libraries.The define line creates a constant. Two global variables are declared using the int i, j; line, which announces the properties in this case, integer of the two variables. Other common variable types are floatfor real number and char for characters, both of which you can declare in the same way as int.The line main declares the main function. Every C program must have a function named main somewhere in the code, which marks the beginning of your program. In C, the statements of a function are enclosed in braces. In the example the mainfunction contains only three statement, which are an assignment statement, a for statement, and a printf statement.The printf statement in C is easier to use. The portion in double quotes is called the at string and describes how the data is to be atted when printed. The at string contains string literals or string constant such as The factorial of, n also called escape sequence. /n stands for carriage returns, and operators in the of d, which are used as placeholders for variables. The two operatorsalso called conversion specifications in the at string indicate that integer values found later in the parameter list are to be placed into the string at these points. Other operators include f for floating point values, c for characters, and s for strings.In the printf statement, it is extremely important that the number of operators in the at string corresponds exactly with the number and type of the variables following it. For example, if the at string contains three operators and it must be followed by exactly three parameters, and they must have the same types in the same order as those specified by the operators.This program is good, but it would be better if it reads in the value instead of using a constant. Edit the file, remove the VALUE constant, and declare a variable value instead as a global integerchanging all references to lower-case because value is now a variable. Then place the following two lines at the beginning of the programPrintf “Enter the value ”;Scanf“d”, Make the changes, then compile and run the program to make sure it works. Note that scanf uses the same sort of at string as printf. The main j1;for I1;IVALUE;I jj*I;printf“The factorial of d is d n”,VALUE,j;如例中所示,C语言程序(代码)以“includestdio.h”一句开始,其目的只是编译程序将C标准函数库蕴含到用户程序中,以便于读写数据、处理文本文件等等。C语言带有大量像“stdio.h”这样的标准函数库,包括字符串处理、时间及数学运算等函数库。“define”一行定义了一个常量。“int i,j”一行说明了两个全局变量,定义了两个变量的属性(本例中为整数)。其他常用的变量类型还有浮点型(指实数型)、字符型(指字符)等,其说明格式同整型类似。“main”一行说明了本程序的主函数。每一个C语言程序都必须有一个名为“main”的函数,可出现于程序的任意位置,用以标记程序的开始。在C语言中函数的语句都被括在一对中。在本例中,主函数包括三行语句,分别是赋值语句、for循环语句,及printf格式输出语句。C语言中的“printf”语句很容易使用。双引号中的部分叫作格式串,用于描述数据在输出时的格式。格式串可以包括字符常量,如“The factorial of”及“n”(又称作转义序列,n表示回车);还可以包括形如“d”的操作符,用作待输出变量的定位符。本例中格式串的两个操作符(又叫作转换说明),表示出现于后续参数表中的整型数值将被置于该格式字符串的指定位置。类似的格式操作符还有表示浮点数值的“f”、表示字符的“c”,及表示字符串的“s”等。必须注意,在“printf”语句中,格式串中操作符的数目与后续的变量在类型及数目上要严格对应。例如,如果格式串包含三个操作符,在后面的参数也必须有三个,并且参数在类型及出现的顺序上要与前面的操作符一致。这个程序还可以,不过,如果能将常量改为由程序读入数值,则会更好一些。编辑该程序,删除VALUE常量,并说明一个全局变量“value”(把所有变更引用都改为小写,因为“value”现已说明为一个变量),然后将以下两行加到程序的开始处printf“Enter the value”;scanf“d”,修改程序,进行编译并运行,以确保程序无误。值得注意的是,“printf”使用的格式串与“scanf”相同,“value”变量前的“”字符在C语言中称作地址操作符,用于返回指定变量的内存地址。出现于“scanf”中的字符型、整型、浮点型,以及记录型(即结构型)的任何变量都必须加上“”操作符。倘若漏掉“”,运行程序时就会出现错误。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/564409.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

lvm 扩展根目录_Lvm扩展根目录容量

2、新加一块硬盘,我的是sdb先创建物理卷[rootredhat6-3~]#fdisk/dev/sdbCommand(mforhelp):nCommandactioneextendedpprimarypartition(1-4)pPartitionnumber(1-4):1Firstcylinder(1-261,default1):(回车,默认将所有空间分配给第一个主分区)Usingdefault…

c语言趣味程序设计编程100例精解,c趣味编程100例

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼#include #include #include #include #include #include #include #include using namespace std;void z1();void z2();void z3();void z4();void z5();void z6();void z7();void z8();int c3(int, int);int draw(int(*)(double),…

SQL语言深入

数据库系统 数据库系统主要有以下 3 个组成部分: 1 . 数据库:用于存储数据的地方。 2 . 数据库管理系统:用于管理数据库的软件。 3 . 数据库应用程序:为了提高数据库系统的处理能力所使用的管理数据库库的软件补充。 数据库管…

tb项目管理实践_项目经理与项目管理整理

项目经理职责:要想项目的分配尽可能地准确,任务分配者必须了解项目研发相关的技术。进行产品开发过程中的业务目标、进度、成本、质量控制。挑选项目团队并进行团队建设,激发、鼓舞和改进团队的生产效率。识别项目干系人,定期向干…

加法的横式竖式教案c语言,20以内竖式加减法教案

【www.ahanw.cn--活动致辞】活动意图:数学的加减法运算很重要。特别是20以内的加减法是各种数字运算的基础。学好20以内的加减法,有利于活化孩子的头脑,发展孩子的思维。活动目标:1、感知进位加、退位减的算法,整理和归…

github随时同步代码_GitHub代码下载和同步

1.下载git客户端https://git-scm.com/ssh-keygen -C "youremail.address" -t rsa2. 把下面文件的内容复制到 https://github.com/settings/keysWindows:C:\Users\GengZhaoyun\.ssh\id_rsa.pubLinux:.ssh\id_rsa.pub测试是否配制正确ssh -T gitgithub.com显示Hi gengz…

c语言10个数求立方合并输出,C语言 求出100~999之间的所有“水仙花数”并输出...

“水仙花数”是指一个三位数,其各位数字的立方和确好等于该数本身,如;153=1+5+3?,则153是一个“水仙花数”。在数论中,水仙花数(Narcissistic number)也称为自恋数、自幂数、阿姆斯…

lstm 变长序列_keras在构建LSTM模型时对变长序列的处理操作

我就废话不多说了,大家还是直接看代码吧~补充知识:RNN(LSTM)数据形式及Padding操作处理变长时序序列dynamic_rnnSummaryRNN样本一样,计算的状态值和输出结构一致,也即是说只要当前时刻的输入值也前一状态值一样,那么其…

c语言平面向量加法考点,平面向量的加减法怎么死活都不会?有没有什么口诀?例如:向量AB+BC=?向量OA-OB=?向量AB-CB=?有没有什么口诀!...

设a(x,y),b(x,y).1、向量的加法向量的加法满足平行四边形法则和三角形法则.ABBCAC.ab(xx,yy).a00aa.向量加法的运算律:交换律:abba;结合律:(ab)ca(bc).2、向量的减法如果a、b是互为相反的向量,那么a-b,b-a,ab0.0的反向量为0AB-ACC…

乘基取整法是什么_数字逻辑电路-学习指南

数字逻辑电路-学习指南一、判断题(判断结果为真(T)或为假(F)1.()逻辑函数的真值表是惟一的,但表达式不一定是惟一的。2.()在基数乘除法中,整数部分的转换采用“除基取余”法,小数部分的转换采用“乘基取整”法。3&…

C语言定义直线的数据类型,C语言 | 数据类型

原标题:C语言 | 数据类型1.变量与常量数据在程序的世界中,可以让计算机按照指令做很多事情,如进行数值计算、图像显示、语音对话、视频播放、天文计算、发送邮件、游戏绘图以及任何我们可以想象到的事情。要完成这些任务,程序需要…

pyqt5生成py的文件为什么是c 语言,如何使用PyQt5在python中创建文件对话框

我有一个名为PDFviewer的python类,在运行该程序时,系统将显示一个窗口,该窗口处理button(打开文件夹),它将打开一个文件对话框,允许用户选择一个目录并显示其中的文件。在问题是,当我尝试单击按钮时&#x…

nosql简答什么是最终一致性_可靠消息最终一致性方案中预发送作用是什么

可靠消息最终一致性方案的核心流程①上游服务投递消息如果要实现可靠消息最终一致性方案,一般你可以自己写一个可靠消息服务,实现一些业务逻辑。首先,上游服务需要发送一条消息给可靠消息服务。这条消息说白了,你可以认为是对下游…

android汽车音频焦点方案,管理音频焦点  |  Android 开发者  |  Android Developers

两个或两个以上的 Android 应用可同时向同一输出流播放音频。系统会将所有音频流混合在一起。虽然这是一项出色的技术,但却会给用户带来很大的困扰。为了避免所有音乐应用同时播放,Android 引入了“音频焦点”的概念。一次只能有一个应用获得音频焦点。当…

neo4j browser执行脚本后不提示用时_还不懂什么是分层自动化测试的,有赞的实践经历告诉你...

来源:https://testerhome.com/articles/19109# 背景先理一下自动化测试的概念,从广义上来说,一切通过工具(程序)的方式来代替或者辅助手工测试的行为都可以成为自动化。从狭义上来说,通过编写脚本的方式,模拟手工测试…

android+自定义alertdialog,安卓自定义AlertDialog

AlertDialog.png使用方法 example:DialogUtil.showAlertDialog(getActivity(), R.mipmap.restart, "退出提示", "你确定要退出吗?"),"确定", "取消", true, new DialogUtil.AlertDialogBtnClickListener() {Overridepublic…

eclipse跳转到指定行快捷键_用什么快捷键可以跳到下一个一样的?

Ctrl Shift O: 引入imports语句Ctrl Shift T: 打开Open Type查找类文件Ctrl Shift F4: 关闭打开的所有窗口Ctrl Shift F: 整形Ctrl Alt ↓(↑) : 向下(上)复制本行 (搞笑)Ctrl D : 删除本行Ctrl O: Open declarations F3 : Open DeclarationCtrl E : 打开编辑器(切…

android 跟随动画,Android实现View拖拽跟随手指移动效果

今天想实现这个功能,但是网上搜索代码,都是利用setPadding,setMargin 等方法去实现的,这在Android 4.0 以前是没问题的,但是,android 4.0 后系统已经提供了更简单的方法给我们用了,就是setTrans…

mysql datetime 后面带了很多0_面试官:MySQL 表设计要注意什么?

作者 孤独烟来自公众号:孤独烟引言大家应该知道烟哥最近要(tiao 咳咳咳),嗯,不可描述!随手讲其中一部分知识,都是一些烟哥自己平时工作的总结以及经验。大家看完,其实能避开很多坑。而且很多问题&#xff0…

poi 顺序解析word_JavaPOI解析word提取数据到excel

Java POI解析Word提取数据存储在Excel一、了解POIPOI以前有了解,这次需求是解析word读取其中标题,还有内容赛选获取自己想要的内容经过两天的学习,开始熟悉Java这么读取word和解析。本文中运用是读取整个页面模块的range,通过对ra…