Using a Make or Project Utility

Chapter 6 - Working with Data

Visual C++ 6: The Complete Reference
Chris H. Pappas and William H. Murray, III
  Copyright 1998 The McGraw-Hill Companies

Understanding Operator Precedence Levels
The order of evaluation of an expression in C is determined by the compiler. This normally does not alter the value of the expression, unless you have written one with side effects. Side effects are those operations that change the value of a variable while yielding a value that is used in the expression, as seen with the increment and decrement operators. The other operators that have side effects are the assignment and compound assignment operators.
Calls to functions that change values of external variables also are subject to side effects. For example:
inum1 = 3;
ianswer = (inum1 = 4) + inum1;
This could be evaluated in one of two ways: either inum1 is assigned 4 and ianswer is assigned 8 (4+4); or the value of 3 is retrieved from inum1 and 4 is then assigned to inum1, with the result being assigned a 7.
There are, however, four operators for which the order of evaluation is guaranteed to be left to right: logical AND (&&), logical OR (||), the comma operator (,), and the conditional operator (?:). Because of this default order of evaluation, you can specify a typical test as follows:
while((c=getchar( )) != EOF) && (C!=’\n’))
The second part of the logical AND (&&) is performed after the character value is assigned to c.
Table 6-4 lists all of the C and C++ operators from highest precedence to lowest and describes how each operator is associated (left to right or right to left). All operators between lines have the same precedence level. Throughout the book you will be introduced to the various operators and how their precedence level affects their performance.

Books24x7.com, Inc 2000 –  


Visual C++ 6(c) The Complete Reference
Visual Studio 6: The Complete Reference
ISBN: B00007FYGA
EAN: N/A
Year: 1998
Pages: 207

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net