Search code examples
clanguage-lawyerkernighan-and-ritchiefunction-call-operator

In a function call, what is the operator, and what are the operands?


I am trying to understand some basics of C. KRC's The C Programming Language says

A function call is a postfix expression, called the function designator, followed by parentheses containing a possibly empty, comma-separated list of assignment expressions (Par.A7.17), which constitute the arguments to the function.

  1. In a function call, what is the operator, and what are the operands?

    Is () the operator?

    Is the function name an operand?

    Are the arguments inside () operands?

  2. Is a function designator a synonym of a function call?

Thanks.


Solution

  • In a function call, () is an operator just like [] is an operator when accessing an array element.

    6.5.2 Postfix operators

    Syntax
    1 postfix-expression:
    primary-expression
    postfix-expression [ expression ]
    postfix-expression ( argument-expression-listopt )
    postfix-expression . identifier
    postfix-expression -> identifier
    postfix-expression ++
    postfix-expression --
    ( type-name ) { initializer-list }
    ( type-name ) { initializer-list , }
    
    argument-expression-list:
    assignment-expression
    argument-expression-list , assignment-expression  
    

    Operand for this operator is the function name (or a pointer to the function).

    Are the arguments inside () operands?

    No. As per the C standard the list of expressions specifies the arguments to the function.