Sums...

This is a discussion on Sums... within the C++ Programming forums, part of the General Programming Boards category; Say i have a variable myvar that is of type unsigned char, what happens if the variable = 200 and ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    25

    Sums...

    Say i have a variable myvar that is of type unsigned char,
    what happens if the variable = 200 and then i sum it 200,
    will it be 256 or 200?

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    If an unsigned char has the value of 200, and then 200 is added to it, the result will roll over. It would then equal 144 since 400 - 256 = 144.

  3. #3
    Registered User
    Join Date
    Oct 2004
    Posts
    25
    oh ok thanks

  4. #4
    Registered User
    Join Date
    Oct 2004
    Posts
    25
    is that standard?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Arrays & Sums
    By mrlooneytoon in forum C Programming
    Replies: 9
    Last Post: 04-05-2007, 07:35 PM
  2. Stringy Sums
    By bumfluff in forum C++ Programming
    Replies: 14
    Last Post: 05-15-2006, 02:52 AM
  3. Calculating Sums
    By faxtoaster in forum C Programming
    Replies: 3
    Last Post: 07-10-2003, 09:23 PM
  4. Sums of an array ??
    By RedRattler in forum C Programming
    Replies: 2
    Last Post: 04-04-2003, 08:23 PM
  5. C++ problem w/ sums
    By Kaoru in forum C++ Programming
    Replies: 5
    Last Post: 09-16-2002, 02:15 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21