Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Instrukcja Użytkownika Strona 34

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 114
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 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.
Przeglądanie stron 33
1 2 ... 29 30 31 32 33 34 35 36 37 38 39 ... 113 114

Komentarze do niniejszej Instrukcji

Brak uwag