宁波中小学计算机程序设计比赛常见编程语言关键字 标签:程序设计
<p>保留字又称关键字,指在高级语言中已经定义过的字,使用者不能再将这些字作为变量名或过程名使用。每种程序设计语言都规定了自己的一套关键字。下面是优学宁波奥数网小编整理的常用程序语言的关键字,大家可以参考下。</p><p><strong>c语言保留字:</strong></p><p>auto:指定变量的存储类型,是默认值</p><p>break:跳出循环或switch语句</p><p>case:定义switch中的case子句</p><p>char:定义字符型变量或指针</p><p>const:定义常量或参数</p><p>continue:在循环语句中,回到循环体的开始处重新执行循环</p><p>default:定义switch中的default子句</p><p>do:定义do-while语句</p><p>double:定义双精度浮点数变量</p><p>else:定义枚举类型</p><p>enum:声明外部变量或函数</p><p>extern:声明外部变量或函数</p><p>float:定义浮点型变量或指针</p><p>for:定义for语句</p><p>goto:定义goto语句</p><p>if:定义if语句或if-else语句</p><p>int:定义整型变量或指针</p><p>long:定义长整型变量或指针</p><p>register:指定变量的存储类型是寄存器变量,Turbo c中用自动变量代替</p><p>return:从函数返回</p><p>short:定义短整型变量或指针</p><p>signed:定义有符号的整型变量或指针</p><p>sizeof:获取某种类型的变量或数据所占内存的大小,是运算符</p><p>static:指定变量的存储类型是静态变量,或指定函数是静态函数</p><p>struct:定义结构体类型</p><p>switch:定义switch语句</p><p>typedef:为数据类型定义别名</p><p>union:定义无符号的整型或字符型变量或指针</p><p>unsigned:定义无符号的整型变量或数据</p><p>void:定义空类型变量或空类型指针,或指定函数没有返回值</p><p>volatile:变量的值可能在程序的外部被改变</p><p>while:定义while或do-while语句</p><!--分页--><p><strong>c++保留字:</strong></p><p>and 替代&&运算 alternative to && operator</p><p>and_eq 替代&=操作 alternative to &= operator</p><p>asm 插入一个汇编指令 insert an assembly instruction</p><p>auto 声明一个局部变量 declare a local variable</p><p>bitand 替代按位与运算符 alternative to bitwise & operator</p><p>bitor 替代|运营商 alternative to | operator</p><p>bool 声明一个布尔变量 declare a boolean variable</p><p>break 摆脱循环 break out of a loop</p><p>case 在一个switch语句的代码块 a block of code in a switch statement</p><p>catch 处理抛出的异常 handles exceptions from throw</p><p>char 声明一个字符变量 declare a character variable</p><p>class 声明一个类 declare a class</p><p>compl 经营者的选择伌 alternative to ~ operator</p><p>const 声明不可改变的数据或功能不更改数据 declare immutable data or functions that do not change data</p><p>const_cast 演员从const变量 cast from const variables</p><p>continue 旁路的循环迭代 bypass iterations of a loop</p><p>default 默认的处理程序在一个case语句 default handler in a case statement</p><p>delete 进行动态内存 make dynamic memory available</p><p>do 循环结构 looping construct</p><p>double 声明一个双精度浮点变量 declare a double precision floating-point variable</p><p>dynamic_cast 执行运行管型 perform runtime casts</p><p>else 候补案件的一个if语句 alternate case for an if statement</p><p>enum 创建枚举类型 create enumeration types</p><p>explicit 只使用构造完全匹配时, only use constructors when they exactly match</p><p>export 允许模板的定义是分开的声明 allows template definitions to be separated from their declarations</p><p>extern 关于变量告诉编译器定义在其它地方 tell the compiler about variables defined elsewhere</p><p>false 恒定代表布尔假值 a constant representing the boolean false value</p><p>float 声明一个浮点变量 declare a floating-point variable</p><p>for 循环结构 looping construct</p><p>friend 给予非成员函数访问私有数据 grant non-member function access to private data</p><p>goto 跳转到程序的不同部分 jump to a different part of the program</p><p>if 执行代码根据测试结果 execute code based on the result of a test</p><p>inline 优化呼吁短职能 optimize calls to short functions</p><p>int 声明一个整数变量 declare an integer variable</p><p>long 声明一个长整型变量 declare a long integer variable</p><p>mutable 重写一个const变量 override a const variable</p><p>namespace 分区的范围定义一个全局命名空间 partition the global namespace by defining a scope</p><p>new 分配新的变量动态内存 allocate dynamic memory for a new variable</p><p>not 替代! alternative to ! 经营者 operator</p><p>not_eq 替代!=操作 alternative to != operator</p><p>operator 创建重载运算符函数 create overloaded operator functions</p><p>or 替代| |操作符 alternative to || operator</p><p>or_eq 替代| =操作 alternative to |= operator</p><p>private 申报一类的私有成员 declare private members of a class</p><p>protected 申报保护的一类成员 declare protected members of a class</p><p>public 申报一类的公有成员 declare public members of a class</p><p>register 要求一个变量进行优化,速度 request that a variable be optimized for speed</p><p>reinterpret_cast改变一个变量的类型 change the type of a variable</p><p>return 从函数返回 return from a function</p><p>short 声明短整型变量 declare a short integer variable</p><p>signed 修改变量类型声明 modify variable type declarations</p><p>sizeof 返回变量或类型的大小 return the size of a variable or type</p><p>static 创建一个变量永久储存 create permanent storage for a variable</p><p>static_cast 执行nonpolymorphic演员 perform a nonpolymorphic cast</p><p>struct 定义一个新的结构 define a new structure</p><p>switch 执行代码的根据不同的变量值 execute code based on different possible values for a variable</p><p>template 创建泛型函数 create generic functions</p><p>this 对当前对象的指针 a pointer to the current object</p><p>throw 抛出一个异常 throws an exception</p><p>true 恒定代表布尔真值 a constant representing the boolean true value</p><p>try 执行代码,可以抛出一个异常 execute code that can throw an exception</p><p>typedef 创建现有类型的一个新类型名称 create a new type name from an existing type</p><p>typeid 描述一个对象 describes an object</p><p>typename 声明一类或未定义类型 declare a class or undefined type</p><p>union 一个结构,多个变量分配到相同的内存位置 a structure that assigns multiple variables to the same</p><p>memory location</p><p>unsigned 声明一个无符号整型变量 declare an unsigned integer variable</p><p>using 进口全部或部分空间到目前的范围 import complete or partial namespaces into the current scope</p><p>virtual 创建一个函数,可以通过派生类中重写 create a function that can be overridden by a derived class</p><p>void 声明职能或没有相关数据类型的数据 declare functions or data with no associated data type</p><p>volatile 警告说,关于变量编译器可以修改意外 warn the compiler about variables that can be modified</p><p>unexpectedly</p><p>wchar_t 声明一个宽字符变量 declare a wide-character variable</p><p>while 循环结构 looping construct</p><p>xor 经营者的选择^ alternative to ^ operator</p><p>xor_eq 替代^ =操作 alternative to ^= operator</p><!--分页--><p><strong>java保留字:</strong></p><p>abstract 抽象的,比如抽象类,抽象函数</p><p>assert 断言,意思是程序若正确,则必然不会出现断言后面附加的情况,若出现了则是程序有错了。</p><p>boolean 布尔型变量,true(真的)或false(假的)</p><p>break 跳出(循环或者是多重分支判断)</p><p>byte 字节型变量,长度是一个字节</p><p>case 多重分支判断的每一个分支前面都会有一个case和一个整型变量,若判断条件等于整型变量则执行这一分支(及后面的分支),直到break出现。</p><p>catch 捕获异常,catch括号里的异常如果被抛出,则执行catch花括号里的代码。</p><p>char 字符变量,用来存储单个字符。</p><p>class 类。</p><p>continue 终止当前循环,并跳到下一循环。</p><p>default 多重分支判断若所有的case都不符合,则直接到default里的代码。</p><p>do 循环的一种。</p><p>double 双字节变量。</p><p>else 与if配对,作为双分支判断的第二个分支。</p><p>enum 枚举型的变量,该变量只有有限个选项,比如一年有12个月,分别是一月,二月……十二月,月份本身就可以做成一个枚举。</p><p>extends 继承了某一个类,作为其子类。</p><p>final 终态的,终态的变量不能改变其引用值(若是基本类型,则不能改变其内容)终态的方法不能被方法所在类继承的子类所覆盖。</p><p>finally 与try catch配对,无论是否抛出异常,最后都要执行的代码。作为善后代码。</p><p>float 浮点型变量,带小数点的变量。</p><p>for 循环的一种,分为for( ; ; )和for( : )两种格式</p><p>if 双条件判断,可以与else配对</p><p>implements 某个类实现了某个接口。</p><p>import 导入某个包,这个包里的类可以不必在前面加上包名就可以直接使用。</p><p>instanceof 若使用了A instanceof B,则返回A对象是否是B类的对象,或者B类派生类(或实现了B接口的类)的对象,返回true或者false。</p><p>int 整型变量</p><p>interface 接口</p><p>long 长整型变量</p><p>native 不知道</p><p>new 生成某一个类的对象的运算符</p><p>package 声明该类属于哪一个包</p><p>private 私有的,不能被本类之外的任何地方访问</p><p>protected 受保护的,不能被本类或者派生类之外的任何地方访问</p><p>public 公有的,可以被任何类访问</p><p>return 函数返回值,或返回(若函数是void的)。</p><p>short 短整型变量</p><p>static 静态的,静态变量和静态方法都是属于类的,不需要有类的具体对象就能够执行的。</p><p>strictfp 不知道</p><p>super 在派生类中指定超类使用super,若访问超类的protected以上的可视级别的变量或方法,可以使用“.”运算符</p><p>switch 多重分支判断</p><p>synchronized 同步的。在多线程中,被标明了synchronized的方法或代码块,只能一个接一个的执行,而不能同时执行。</p><p>this 本对象的,this.变量或this.方法,指的是本类的成员变量或本类的成员方法。若该类是某个类的内部类,则this.变量或this.方法指的是外部类的变量或方法。</p><p>throw 抛出指定的异常。</p><p>throws 声明某个方法可能会抛出什么异常给方法的调用者。</p><p>transient 不知道</p><p>try 当抛出异常的时候,若异常属于try后面catch所标明的异常类型,则中断try块里的代码,直接跳到对应的catch里。catch可以有多个,并且前面的catch优先于后面的catch。</p><p>void 无返回值。</p><p>volatile 不知道</p><p>while 循环。</p><p>cast 保留字,没有使用</p><p>false 假</p><p>future 保留字,没有使用</p><p>generic 保留字,没有使用</p><p>inner 保留字,没有使用</p><p>operator 保留字,没有使用</p><p>outer 保留字,没有使用</p><p>rest 保留字,没有使用</p><p>true 真</p><p>var 保留字,没有使用</p><p>goto 跳转到指定的标签位置。标签是用“标签名:”的格式声明的。</p><p>const 保留字,没有使用</p><p>null 空的,将某个引用设置为空,则该引用不指向任何对象。</p>
页:
[1]