Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Manual do Utilizador Página 34

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 114
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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 página 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 ... 113 114

Comentários a estes Manuais

Sem comentários