function

来自「C实现的MUD,对大家基本入门网络游戏很有帮助!」· 代码 · 共 38 行

TXT
38
字号
* The LPC function (or method):

The LPC function is similar but not identical to that provided by C
(it is most similar to that provided by ANSI C).  The syntax is as follows:

return_type function_name(arg1_type arg1, arg2_type arg2, ...)
{
	variable_declarations;
	...;

	statements;
	...;
	return var0;
}

Note that var0 must be of return_type.

If a function doesn't need to return a value, then it should be declared
with a return_type of "void".  E.g.

void function_name(arg1_type arg1, ...)
{
	statements;
	...;
}

Invoke a function as follows:

function_name(arg1, arg2, arg3, ...);

You may invoke a function in another object as follows:

object->function_name(arg1, arg2, arg3, ...);

or:

call_other(object, function_name, arg1, arg2, ...);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?