宁波中小学计算机程序设计比赛常见编程语言关键字_杯赛竞赛-查字典奥数网
 
请输入您要查询的关键词

宁波中小学计算机程序设计比赛常见编程语言关键字

2012-08-21 14:53:20     标签:程序设计

保留字又称关键字,指在高级语言中已经定义过的字,使用者不能再将这些字作为变量名或过程名使用。每种程序设计语言都规定了自己的一套关键字。下面是查字典宁波奥数网小编整理的常用程序语言的关键字,大家可以参考下。

c语言保留字:

auto:指定变量的存储类型,是默认值

break:跳出循环或switch语句

case:定义switch中的case子句

char:定义字符型变量或指针

const:定义常量或参数

continue:在循环语句中,回到循环体的开始处重新执行循环

default:定义switch中的default子句

do:定义do-while语句

double:定义双精度浮点数变量

else:定义枚举类型

enum:声明外部变量或函数

extern:声明外部变量或函数

float:定义浮点型变量或指针

for:定义for语句

goto:定义goto语句

if:定义if语句或if-else语句

int:定义整型变量或指针

long:定义长整型变量或指针

register:指定变量的存储类型是寄存器变量,Turbo c中用自动变量代替

return:从函数返回

short:定义短整型变量或指针

signed:定义有符号的整型变量或指针

sizeof:获取某种类型的变量或数据所占内存的大小,是运算符

static:指定变量的存储类型是静态变量,或指定函数是静态函数

struct:定义结构体类型

switch:定义switch语句

typedef:为数据类型定义别名

union:定义无符号的整型或字符型变量或指针

unsigned:定义无符号的整型变量或数据

void:定义空类型变量或空类型指针,或指定函数没有返回值

volatile:变量的值可能在程序的外部被改变

while:定义while或do-while语句

c++保留字:

and 替代&&运算 alternative to && operator

and_eq 替代&=操作 alternative to &= operator

asm 插入一个汇编指令 insert an assembly instruction

auto 声明一个局部变量 declare a local variable

bitand 替代按位与运算符 alternative to bitwise & operator

bitor 替代|运营商 alternative to | operator

bool 声明一个布尔变量 declare a boolean variable

break 摆脱循环 break out of a loop

case 在一个switch语句的代码块 a block of code in a switch statement

catch 处理抛出的异常 handles exceptions from throw

char 声明一个字符变量 declare a character variable

class 声明一个类 declare a class

compl 经营者的选择〜 alternative to ~ operator

const 声明不可改变的数据或功能不更改数据 declare immutable data or functions that do not change data

const_cast 演员从const变量 cast from const variables

continue 旁路的循环迭代 bypass iterations of a loop

default 默认的处理程序在一个case语句 default handler in a case statement

delete 进行动态内存 make dynamic memory available

do 循环结构 looping construct

double 声明一个双精度浮点变量 declare a double precision floating-point variable

dynamic_cast 执行运行管型 perform runtime casts

else 候补案件的一个if语句 alternate case for an if statement

enum 创建枚举类型 create enumeration types

explicit 只使用构造完全匹配时, only use constructors when they exactly match

export 允许模板的定义是分开的声明 allows template definitions to be separated from their declarations

extern 关于变量告诉编译器定义在其它地方 tell the compiler about variables defined elsewhere

false 恒定代表布尔假值 a constant representing the boolean false value

float 声明一个浮点变量 declare a floating-point variable

for 循环结构 looping construct

friend 给予非成员函数访问私有数据 grant non-member function access to private data

goto 跳转到程序的不同部分 jump to a different part of the program

if 执行代码根据测试结果 execute code based on the result of a test

inline 优化呼吁短职能 optimize calls to short functions

int 声明一个整数变量 declare an integer variable

long 声明一个长整型变量 declare a long integer variable

mutable 重写一个const变量 override a const variable

namespace 分区的范围定义一个全局命名空间 partition the global namespace by defining a scope

new 分配新的变量动态内存 allocate dynamic memory for a new variable

not 替代! alternative to ! 经营者 operator

not_eq 替代!=操作 alternative to != operator

operator 创建重载运算符函数 create overloaded operator functions

or 替代| |操作符 alternative to || operator

or_eq 替代| =操作 alternative to |= operator

private 申报一类的私有成员 declare private members of a class

protected 申报保护的一类成员 declare protected members of a class

public 申报一类的公有成员 declare public members of a class

register 要求一个变量进行优化,速度 request that a variable be optimized for speed

reinterpret_cast改变一个变量的类型 change the type of a variable

return 从函数返回 return from a function

short 声明短整型变量 declare a short integer variable

signed 修改变量类型声明 modify variable type declarations

sizeof 返回变量或类型的大小 return the size of a variable or type

static 创建一个变量永久储存 create permanent storage for a variable

static_cast 执行nonpolymorphic演员 perform a nonpolymorphic cast

struct 定义一个新的结构 define a new structure

switch 执行代码的根据不同的变量值 execute code based on different possible values for a variable

template 创建泛型函数 create generic functions

this 对当前对象的指针 a pointer to the current object

throw 抛出一个异常 throws an exception

true 恒定代表布尔真值 a constant representing the boolean true value

try 执行代码,可以抛出一个异常 execute code that can throw an exception

typedef 创建现有类型的一个新类型名称 create a new type name from an existing type

typeid 描述一个对象 describes an object

typename 声明一类或未定义类型 declare a class or undefined type

union 一个结构,多个变量分配到相同的内存位置 a structure that assigns multiple variables to the same

memory location

unsigned 声明一个无符号整型变量 declare an unsigned integer variable

using 进口全部或部分空间到目前的范围 import complete or partial namespaces into the current scope

virtual 创建一个函数,可以通过派生类中重写 create a function that can be overridden by a derived class

void 声明职能或没有相关数据类型的数据 declare functions or data with no associated data type

volatile 警告说,关于变量编译器可以修改意外 warn the compiler about variables that can be modified

unexpectedly

wchar_t 声明一个宽字符变量 declare a wide-character variable

while 循环结构 looping construct

xor 经营者的选择^ alternative to ^ operator

xor_eq 替代^ =操作 alternative to ^= operator

java保留字:

abstract 抽象的,比如抽象类,抽象函数

assert 断言,意思是程序若正确,则必然不会出现断言后面附加的情况,若出现了则是程序有错了。

boolean 布尔型变量,true(真的)或false(假的)

break 跳出(循环或者是多重分支判断)

byte 字节型变量,长度是一个字节

case 多重分支判断的每一个分支前面都会有一个case和一个整型变量,若判断条件等于整型变量则执行这一分支(及后面的分支),直到break出现。

catch 捕获异常,catch括号里的异常如果被抛出,则执行catch花括号里的代码。

char 字符变量,用来存储单个字符。

class 类。

continue 终止当前循环,并跳到下一循环。

default 多重分支判断若所有的case都不符合,则直接到default里的代码。

do 循环的一种。

double 双字节变量。

else 与if配对,作为双分支判断的第二个分支。

enum 枚举型的变量,该变量只有有限个选项,比如一年有12个月,分别是一月,二月……十二月,月份本身就可以做成一个枚举。

extends 继承了某一个类,作为其子类。

final 终态的,终态的变量不能改变其引用值(若是基本类型,则不能改变其内容)终态的方法不能被方法所在类继承的子类所覆盖。

finally 与try catch配对,无论是否抛出异常,最后都要执行的代码。作为善后代码。

float 浮点型变量,带小数点的变量。

for 循环的一种,分为for( ; ; )和for( : )两种格式

if 双条件判断,可以与else配对

implements 某个类实现了某个接口。

import 导入某个包,这个包里的类可以不必在前面加上包名就可以直接使用。

instanceof 若使用了A instanceof B,则返回A对象是否是B类的对象,或者B类派生类(或实现了B接口的类)的对象,返回true或者false。

int 整型变量

interface 接口

long 长整型变量

native 不知道

new 生成某一个类的对象的运算符

package 声明该类属于哪一个包

private 私有的,不能被本类之外的任何地方访问

protected 受保护的,不能被本类或者派生类之外的任何地方访问

public 公有的,可以被任何类访问

return 函数返回值,或返回(若函数是void的)。

short 短整型变量

static 静态的,静态变量和静态方法都是属于类的,不需要有类的具体对象就能够执行的。

strictfp 不知道

super 在派生类中指定超类使用super,若访问超类的protected以上的可视级别的变量或方法,可以使用“.”运算符

switch 多重分支判断

synchronized 同步的。在多线程中,被标明了synchronized的方法或代码块,只能一个接一个的执行,而不能同时执行。

this 本对象的,this.变量或this.方法,指的是本类的成员变量或本类的成员方法。若该类是某个类的内部类,则this.变量或this.方法指的是外部类的变量或方法。

throw 抛出指定的异常。

throws 声明某个方法可能会抛出什么异常给方法的调用者。

transient 不知道

try 当抛出异常的时候,若异常属于try后面catch所标明的异常类型,则中断try块里的代码,直接跳到对应的catch里。catch可以有多个,并且前面的catch优先于后面的catch。

void 无返回值。

volatile 不知道

while 循环。

cast 保留字,没有使用

false 假

future 保留字,没有使用

generic 保留字,没有使用

inner 保留字,没有使用

operator 保留字,没有使用

outer 保留字,没有使用

rest 保留字,没有使用

true 真

var 保留字,没有使用

goto 跳转到指定的标签位置。标签是用“标签名:”的格式声明的。

const 保留字,没有使用

null 空的,将某个引用设置为空,则该引用不指向任何对象。

查看全部
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关文章
热门文章
最新文章
猜你喜欢