1. ## Modulus Operator!

I'm trying to Down size a 5 digit number on an array of [26] values each value has well 5 digits
i want to just use the last two digits for the value how would i be able to do that with
the modulus operator. I was told the mod OP would be perfect, i just dont know how to use it with arrays..

thanks

2. Um..... I think you want to do a modulus operation of 100 on each element in the array, but your description is so ambiguous and vague, I can't figure out what you want.

3. i did specify that i dont know how to use the modulus when it comes to arrays i get errors when i try to use my assignments.

examples would be

array[90] %= 100

*(array % 100)
...........................
lame examples but im new sorry

4. So what do you want? An array tutorial, or a modulus tutorial?

5. unless you want to rewrite the C Primer book is up to you. But no really i would just like an example on how would i be able to use the modulus OP on an array with values but im guessing its hard to think of the answer.

embeded systm

6. You're guessing wrong. This is super easy.

Code:
`x = array[0] &#37; 100;`
Assuming all variables are ints in this example, if array[0] is 1234, x should contain 34.

7. Yes, this would work: array[90] &#37;= 100; (if you want to assign the result back to array[90])

What errors do you get? What does your code look like?

8. And it's worth noting that the language C doesn't have ANY operations that operate on all elements in an array - you can call a function that, given the array and the size of it, can do something on the whole array by ways of doing a loop in the function, but the C language itself only sees arrays as a sequence of elements - there's no way you can actually operate on "all elements of this array" in one fell swoop.

--
Mats