Rich Bradshaw
Rich Bradshaw

Reputation: 72975

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

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...

Upvotes: 3

Views: 597

Answers (4)

helpermethod
helpermethod

Reputation: 62165

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

Upvotes: -1

Dario
Dario

Reputation: 49218

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.

Upvotes: 4

Prasoon Saurav
Prasoon Saurav

Reputation: 92864

function prototype,declaration or signature

Upvotes: 4

Kornel Kisielewicz
Kornel Kisielewicz

Reputation: 57555

Could be called header, declaration or signature.

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

Upvotes: 7

Related Questions