P
Paulo Jorge de O. C. de Matos
Hello all,
I am trying to understand in detail the correct wording to use in C
for teaching purposes.
For the example:
int foo(int x, int y) {
int k;
...
return k;
}
you could call foo a function or a procedure. On this matter I guess
that the choice is function (K&R2 and C99 standard) given there's no
occurrences of the word procedure there as far as I can tell. Still,
it is unfortunate because you need to explain that these functions are
not in the mathematical sense and so on but it's not a huge issue.
On the other hand, what do you call x? Is it an argument or a parameter?
K&R2 seems to mention both words and I couldn't spot the difference. I
would then assume that "int x, int y" is the argument list/ parameter
list according to what x and y are. But which wording to use?
Moreover, I presented the function definition. The function
declaration would be:
int foo(int x, int y);
but, what if I present the function definition and want to refer only
to the part before the body of the function (compound statement as far
as C99 is concerned)? Shall I call it function declaration (seems
ambiguous since I already used function declaration above) or function
header (this one might create confusion with header files).
I would appreciate input on this.
Best Regards,
I am trying to understand in detail the correct wording to use in C
for teaching purposes.
For the example:
int foo(int x, int y) {
int k;
...
return k;
}
you could call foo a function or a procedure. On this matter I guess
that the choice is function (K&R2 and C99 standard) given there's no
occurrences of the word procedure there as far as I can tell. Still,
it is unfortunate because you need to explain that these functions are
not in the mathematical sense and so on but it's not a huge issue.
On the other hand, what do you call x? Is it an argument or a parameter?
K&R2 seems to mention both words and I couldn't spot the difference. I
would then assume that "int x, int y" is the argument list/ parameter
list according to what x and y are. But which wording to use?
Moreover, I presented the function definition. The function
declaration would be:
int foo(int x, int y);
but, what if I present the function definition and want to refer only
to the part before the body of the function (compound statement as far
as C99 is concerned)? Shall I call it function declaration (seems
ambiguous since I already used function declaration above) or function
header (this one might create confusion with header files).
I would appreciate input on this.
Best Regards,