If you're working with positive integers, the % operator in C will give you
the modulus. Here is an uncompiled example:
UInt16 a, b, c;
a = 106;
b = 5;
c = a % b;
Result: c == 1
If either of your arguments to the modulus function can be negative, the
behavior of the % operator is machine dependent. Therefore, it's best to
avoid relying on it, and stick to positive arguments. This info is care of
Harbison & Steele, C: A Reference Manual.
I've used % successfully in this way in Palm applications, so I can assure
you that it does indeed work.
I haven't tried doing modulus on floating point numbers, so I'll leave it to
others to help you if that is your goal.
--
Peter Epstein
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/