Chapter 4: C Types, Operators, and Expressions
hich will scroll by so fast you won’t see it, so you’ll assume the compile was
OT) this warning was? Most complier warnings are
en m ag this error with a warning. It is a
will feel really dumb after an hour of
only to find a lousy missing ‘=’may seem strange at this point, but they are
xplained fully in later sections. Then they’ll seem really strange.perat DefinedW
good. Notice how clear (N
ev ore cryptic. Not all compilers will fl
very easy mistake to make, and you
debugging, looking for something obscure,
character. I do this all the time.
Note: Some of these operators
e
Table 1: Arithmetic Operators
O or Name Example
- Multiplication x*y Multiply x times y
/ Division x/y Divide x by y
% Modulo x%y Provide the remainder of x divided by y
- Addition x+y Add x and y
- Subtraction x-y Subtract y from x
++ Increment x++ Increment x after using it
-- Decrement --x Decrement x before using it - Negation -x Multiply x by –1
- Unary Plus +x Show x is positive (not really needed)
Table 2: Data Access and Size Operators
Operator Name Example Defined
[] Array element x[6] Seventh element of array x
. Member selection PORTD.2 Bit 2 of Port D
-> pStruct->x Member x of the structure pointed to
by pStruct
Member selection- Indirection *p Contents of memory located at
address p
& Address of &x Address of the variable x