October 17th, 2013, 07:31 PM
Expressions in c
an expression is a combination of operators and operands?
Does ANSI have a list of valid operands?
October 17th, 2013, 08:37 PM
A valid operand is just another an expression, so pretty much anything works: constants, variables, pointers, assignments, function calls...
October 18th, 2013, 01:11 PM
An operand is simply an expression. What determines validity of an operand is its type (int, float, double, etc or a pointer-type) and whether it is defined for the particular operator.
Perhaps you confused operand and operator, and meant a "list of operators"? The answer to that question is however easily available elsewhere and not worth repeating here.
The operators available in a language (you did not specify C, C++ Objective-C or C# - all covered by this forum), are defined by the language not ANSI. ANSI is a US national standard's body, not a programming language. ANSI did at one time define the standard for C, but that is now the responsibility of the ISO. ANSI C refers to the pre-ISO standard commonly referred to as C89. ISO C90 is identical in language terms, both are superseded by C99 and C11 (the numbering scheme shows we have learned nothing from the Y2K bug ;))
October 18th, 2013, 01:13 PM
...Although pointers are valid for a smaller subset of operators that other types.
Originally Posted by requinix
October 18th, 2013, 01:18 PM
Just simply refer to the syntax.
Originally Posted by web9452
Eg, The syntax of C in Backus-Naur Form. Or you could Google for more examples.
You might want to start with this and start expanding:
<expression> ::= <assignment-expression>
| <expression> , <assignment-expression>