In the third last paragraph at page number 26 of the ebook "The C Programming Language" the author(s) say,
"We will generally use parameter for a variable named in the parenthesized list in a function. The terms formal argument and actual argument are sometimes used for the same distinction."
And in the hard copy of the book that I am having, on the second last paragraph of page number 25 the author(s) say,
"We will generally use parameter for a variable named in the parenthesized list in a function definition, and argument for the value used in a call of the function. The terms formal argument and actual argument are sometimes used for the same distinction."
If I understand it correctly, it means whatever the value(or variable) is used in the call of a function, that is called argument. And whatever is written in the paranthesis of the definition of a function, that is called parameter. E.g. in the following code:
#include<stdio.h>
int func(int j)
{
return j;
}
main()
{
int k=5;
printf("The argument = %d", func(k));
}
the parameters are declared by the line int func(int j)
. The argument given, through which main()
and func(int j)
communicate is k
.
Now, on the page number 30 of the book(both, the ebook and the hard copy) the authors state,
"
main
andgetline
communicate through a pair of arguments and a returned value. Ingetline
, the arguments are declared by the line
int getline(char s[], int lim);"
As I understand, char s[]
and int lim
are parameters, because they are written in the definition of the function getline
, not in the call of that function, so my question is,
Why have the authors used the word argument in the second paragraph of page number 30?
main
andgetline
communicate through a pair of arguments and a returned value They are not using the word formal argument. They are using the word argument.