Understanding the concept of “arguments” and “parameters”

In the third last paragraph at page number 26 of the ebookThe 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 and getline communicate through a pair of arguments and a returned value. In
getline, 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?

7

English (and I presume other languages as well) has a lot of words which can be used in a generic sense, but are no longer correct in a context which requires more distinction. For example, you can use the word “goose” to refer to a goose of any gender or age when speaking in the more common generic sense, but if a distinction must be made, a male goose is properly called a gander, and a baby goose is properly called a gosling.

“Argument” and “parameter” are two such words. You can use “argument” in a more loose context to refer to either an argument or a parameter, but in certain circumstances it’s helpful to be able to distinguish between them precisely. Those circumstances are rare enough that many programmers don’t learn the distinction for years, if ever.

Don’t ask me why English is that way. It wasn’t designed for ease of parsing.

1

The term “argument” is often used rather loosely to refer to either actual arguments or formal arguments without giving the actual or formal adjective. Most often, the context makes it clear if actual arguments or formal arguments/parameters is meant.

In this case, it should be clear that the authors meant formal arguments or parameters. As to why they didn’t use parameters is pure speculation. It can be a simple oversight or a deliberate choice because it made the text flow better.

5

First, let’s recap:

  • “parameter = the variable’s name”
  • “argument = the expression we pass to the function”

Note too that “argument” isn’t the variable’s name. Therefore, it is everything else. Figuratively speaking, you can think of “argument” as a pipe/line. A line that connects the text in the source code holding the “actual argument” with the text in the source code naming the “formal argument”.

This pipe has a type. It represent a C cast. A cast is defined by the source type and the destination type.

When they tell you that “the arguments are declared by the line int getline(char s[], int lim)” they tell you that here’s the definition of the pipe (which is “argument”): its target type is “char []” (and source type can be anything).

3

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật