Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>conversions usual arithmetic conversions</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Conversions              Usual Arithmetic Conversions

    Many binary operators that expect arithmetic type operands cause
    conversions.  The purpose of conversions is to yield a common type,
    which becomes the type of the result.  This pattern is called "the
    usual arithmetic conversions."  Here are the step-by-step tests for
    conversions, according to the ANSI Draft of the C programming
    language.  To use this table, scan it from top to bottom, and use the
    first rule that applies.


  ------------------------------ Conversion --------------------------------
          If either operand                  then convert the
          has the type                       other operand to
  ---------------------------------------------------------------------------
          long double                        long double

          double                             double

          float                              float

          unsigned long int                  unsigned long int

          long int                           long int

          char                               int
          enum                               int
          short                              int

          unsigned int                       unsigned int
  ---------------------------------------------------------------------------

       Note:    If after performing the integral promotions shown in the
                next to last line of the table (char, enum and short
                convert to int), either operand then has type unsigned
                int, the other operand is converted to unsigned int (as
                shown in the last line of the table).

                For any situation not covered by the table, both operands
                are of type int.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson