expression types

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sophia.agnes@gmail.com

    expression types

    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?
  • santosh

    #2
    Re: expression types

    sophia.agnes@gm ail.com wrote:
    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?
    See section 6.5 of the Standard.

    Comment

    • jameskuyper@verizon.net

      #3
      Re: expression types



      sophia.ag...@gm ail.com wrote:
      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.

      Comment

      • pete

        #4
        Re: expression types

        sophia.agnes@gm ail.com wrote:
        >
        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?
        There's
        1 Function types
        according to return type and parameter types.
        Function types don't have sizes.
        2 Incomplete types
        void, which can't be completed and
        other types which can be completed.
        Incomplete types don't have sizes.
        Expressions of incomplete types don't have values.
        3 Object types
        Expressions of object types have sizes.
        A Scalar types
        1 Arithmetic types
        a Basic types
        1 char
        2 Integer types
        A signed integer types
        1 signed char
        2 short int
        3 int
        4 long int
        5 long long int
        B unsigned integer types.
        1 unsigned char
        2 unsigned short
        3 unsigned
        4 long unsigned
        5 long long unsigned
        3 Floating types
        A float
        B double
        C long double

        b Complex types
        2 Pointer Types
        a Function pointers
        b Object pointers
        B Aggregate types
        1 Arrays
        2 Structures
        C Unions


        --
        pete

        Comment

        Working...