Dear all,
what are the major expression types in c?
i have seen the following types of expressions
1) constant expressions
2) integral expressions
3) float expressions
4) pointer expressions
is there any other expression type in c?
You can classify expressions in many different ways. However, if you
want to have a mutually exclusive hierarchial list of categories, your
item 1 doesn't belong with your items 2-4, since a constant expression
can have any of those other types.
The most natural way to categorize expressions is based upon which
operator acts at the highest level in the expression.
Your items 2-4 classify expressions by the type of the value of the
expression. There's a complicated hierarchy of type categories.
There's several named type categories under "integer types", and
"floating types". There's a larger type category that includes both:
"arithmetic types". A still larger type category includes "pointer
types", which is called "scalar types". A distinct type category which
you haven't mentioned is "aggregate types", which is comprised of
array and structure types. These are all object types. There are also
function types and incomplete types.
There's also a few data type categories that cross boundaries between
other type categories, preventing the type category system being
presented as a pure hierarchy. Examples: character types, real types,
derived types (pointer, structure, union, and array types). For every
one of these type categories, it's possible to construct an expression
whose value has that type.