Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Manual de usuario Pagina 34

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 114
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 33
Publication 2098-PM001E-EN-P — July 2002
1-22 Programming Motion Control in C
For example, the following code yields the absolute value of a
number.
if (y < 0)
x = -y;
else
x=y;
This statement can be written as
x=(y<0)?–y:y;
The meaning of either statement above is: If y is less than zero, then x
= -y; else, x = y.
Operator Precedence
The following table shows the precedence of the operators introduced
in this chapter and the associativity (i.e., the direction in which each
operation flows).
Operator: Associativity:
( ) [ ] -> . Left to right
! - ++ -- + - * & (type) sizeof Right to left
* / % Left to right
+ - Left to right
<< >> Left to right
< <= > >= Left to right
== != Left to right
& Left to right
^ Left to right
| Left to right
&& Left to right
|| Left to right
?: Right to left
= += -= /= %= &= ^= |= <<= >>= Right to left
, Left to right
Note: Unary +, -, and * have higher precedence than the binary forms.
Vista de pagina 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 ... 113 114

Comentarios a estos manuales

Sin comentarios