views:

135

answers:

4

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

+6  A: 

Could be called header, declaration or signature.

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

Kornel Kisielewicz
you might also add a return type to the function declaration
Alon
Signature was what I was thinking of, declaration sounds good as well!
Rich Bradshaw
Signature was by @skaffman, +1 him up somewhere if you like it :P
Kornel Kisielewicz
+6  A: 

function prototype,declaration or signature

Prasoon Saurav
+4  A: 

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.

Dario
Doesn't "definition" include the body?
Kornel Kisielewicz
As I posted, it does ( /* code */ )
Dario
A: 

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

Helper Method