3

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

skaffman
  • 398,947
  • 96
  • 818
  • 769
Rich Bradshaw
  • 71,795
  • 44
  • 182
  • 241
  • It's probably a mistake to look for a language-agnostic answer here. Different languages have their own terminologies, for instance in C a function "declaration" and a function "signature" are not quite the same thing - the declaration is a concrete bit of code, that specifies the signature, which is a property of the function. So if the language you're actually using has its own jargon it's probably better to use that, rather than to use generic meanings which might conflict with language-specific meanings. – Steve Jessop Jan 17 '10 at 14:09
  • Good point - I'm specifically thinking of Python, but C is the language I was formally taught. – Rich Bradshaw Jan 17 '10 at 18:04
  • 1
    In Python I'd call it a function signature. Python doesn't need declarations, and I think bringing in a C term would confuse things more than it explains them. – Steve Jessop Jan 18 '10 at 01:56

4 Answers4

7

Could be called header, declaration or signature.

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

Kornel Kisielewicz
  • 55,802
  • 15
  • 111
  • 149
4

function prototype,declaration or signature

Prasoon Saurav
  • 91,295
  • 49
  • 239
  • 345
4

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
  • 48,658
  • 8
  • 97
  • 130
-1

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

helpermethod
  • 59,493
  • 71
  • 188
  • 276