开发者

What's the name for the first line of a function?

开发者 https://www.devze.com 2022-12-16 20:49 出处:网络
I\'m writing a worksheet, and want to ask students to write a function that looks like this: isPrime(int number)

I'm writing a worksheet, and want to ask students to write a function that looks like this:

isPrime(int number)

What's开发者_运维知识库 that line called - manifest comes to mind, but I don't think that's it...


Could be called header, declaration or signature.

The first one would go well with "function declaration", "function header", "function body".


function prototype,declaration or signature


If you write

bool isPrime(int);

you call this declaration whereas

bool isPrime(int number) { /* code */ }

is the actual definition. (C allows a explicit distinction here)

Generally, your expression is called the (type) signature of a function.


Signature == name, number of parameters, type of parameters, but NOT the return type, whereas declaration == signature + return type

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号