A function produces a result, can be used as argument of another function parameter. So, is a function call like:
f(1,2,3)
be considered as an "expression"? Thanks.
A function call is an expression containing the function name followed by the function call operator, () . If the function has been defined to receive parameters, the values that are to be sent into the function are listed inside the parentheses of the function call operator.
A function call is an expression. Since any expressions is also an expression statement, that means a function call is also a statement.
A function call is a postfix expression consisting of a function designator followed by parentheses. The order of evaluation of any expressions in the function parameter list is undefined, but there is a sequence point before the actual call.
The function call operator is denoted by “()” which is used to call function and pass parameters. It is overloaded by the instance of the class known as a function object. When the function call operator is overloaded, an operator function is created that can be used to pass parameters.
The C++ standard (N3376, §5.1) specifies an expression as:
An expression is a sequence of operators and operands that specifies a computation. An expression can result in a value and can cause side effects.
Further in the same section (§5.2.2):
A function call is a postfix expression followed by parentheses containing a possibly empty, comma-separated list of expressions which constitute the arguments to the function.
In short, yes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With