Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C语言中函数的名称_C_Function_Prototype - Fatal编程技术网

C语言中函数的名称

C语言中函数的名称,c,function,prototype,C,Function,Prototype,我知道这个问题听起来很愚蠢,但请回答 假设我们有inta(intnum)作为功能原型 函数的名称是什么int A(int num)或A 函数的主体是否也在定义的顶部 int A(int num){ <-- Does the body include this? return num * num; } inta(intnum){通常,函数名只能是“A”;正如您所说,inta(intnum)是它的原型;函数的作用是主体,所以这里只需返回(num*num)。当使用允许重

我知道这个问题听起来很愚蠢,但请回答

假设我们有
inta(intnum)作为功能原型

函数的名称是什么<代码>int A(int num)
A

函数的主体是否也在定义的顶部

int A(int num){        <-- Does the body include this?

    return num * num;
}

inta(intnum){通常,函数名只能是“A”;正如您所说,
inta(intnum)
是它的原型;函数的作用是主体,所以这里只需
返回(num*num)
。当使用允许重载的语言引用函数时,您可以使用原型而不是名称。

int a(int num)
名称
a

第一部分,
int
,描述函数的返回类型,然后是函数名,
A
,最后是函数接受的参数列表
(int num)
。在这种情况下,它是类型为int的单个参数

函数的主体是实际执行函数功能的代码。基本上是花括号中的代码:
{}

int A(int num){        

    return(num * num);    //this is the body
}

A
是名字,
int A(int num);
是原型。作为一个次要的观点,
return
不是一个函数,也不需要明确任何事情的优先级,所以去掉括号。它只是
return num*num;
@unwind ok changed i It:)