天天看點

parameter 和 argument 的差別

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.”