Thread: Modulus Operator!

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Yes, this would work: array[90] %= 100; (if you want to assign the result back to array[90])

    What errors do you get? What does your code look like?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    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
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. modulus operator with double operands?
    By chickenandfries in forum C Programming
    Replies: 7
    Last Post: 03-28-2008, 07:21 AM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. modulus operator / '%' question
    By musikluvah in forum C Programming
    Replies: 4
    Last Post: 01-17-2006, 12:09 PM
  5. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:51 PM