Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C terminology: header vs. signature

Tags:

c

terminology

the word header as far as I know is usually in reference to a header file while the word signature is in reference to the arguments and return type of the function. For example, in my experience this would be called a signature:

int ptInPoly(Point q, Point p[], int n)

My professor is calling this a header in my assignments. I have found this confusing and would like to know if this different use terminology is common or something that only he does. Thanks

Here is some more context around the use of the term header:

"Your program must have a function with header: int ptInPoly(Point q, Point p[], int n) that determines if point q is in the polygon given in p"

like image 756
Mathew Avatar asked Oct 30 '25 03:10

Mathew


1 Answers

The correct term is function declaration. When the parameter types are spelled out explicitly, as in your case int ptInPoly(Point q, Point p[], int n); it can also be called a function prototype. (Non-prototype format is considered very bad practice and rarely used nowadays.) A function prototype is a function declaration.

Function declaration and function prototype are formal terms used by the C standard.

The meaning of header is indeed a header file, with .h as extension. The C standard uses the term header to describe header files.

So your professor is using the wrong terminology.

like image 149
Lundin Avatar answered Oct 31 '25 22:10

Lundin