parameter和argument從字面翻譯上都可以翻譯爲“參數”,那麼二者有什麼區別呢?以前總是傻傻分不清楚,不過今天翻看C89標準,並參考網上其他信息,總算搞清楚了。簡單說來,parameter一般指形參,而argument一般指實參。(什麼?形參實參是啥?這位同學下課之後請到我辦公室來一趟……)
下面是C89英文文檔裏的原文和參考翻譯(翻譯如有誤還請見諒):
3.2 argument. An expression in the comma-separated list bounded by the parentheses in a function call expression. or a sequence of preprocessing tokens in the comma-separated list bounded by the parentheses in a function-like macro invocation. Also known as “actual argument” or “actual parameter.”
argument:指函數調用表達式中用括號括起來並用逗號分隔的一系列表達式,或者類似於函數的宏調用中的用括號括起來並以逗號分隔開的一系列預處理符號。也叫做“實際參數”。
3.15 parameter. An object declared as part of a function declaration or defnition that acquires a value on entry to the function. or an identilier from the comma-separated list bounded by the parentheses immediately following the macro name in a function-like macro detinttion Also known as “formal argument” or “formal parameter.”
parameter:指作爲具有入口值函數的聲明或定義的一部分的一個對象,或是跟在類似於函數的宏定義的宏名之後,由括號括起來並用逗號分隔開的標識符。也叫做“形式參數”。
在不嚴格的情況下兩者可以混用,但是習慣上使用argument而不是parameter,後者不常用。