Thread: C++ Primer

  1. #1
    Hmm...? gin's Avatar
    Join Date
    Jun 2008
    Location
    Glasgow, Scotland
    Posts
    51

    C++ Primer

    Hi, I'm reading C++ Primer 4th Edition at the moment and have encountered something in the book which doesn't make sense to me, I don't know if I've interpreted it wrong or something but how does this equal 255:

    "So, if we assign 1 to an 8-bit unsigned char, the resulting value will be 255, which is 1 modulo 256."

    I don't seem to understand, wouldn't it be 1 since you've assigned it as 1? Sorry for asking such a stupid question.

  2. #2
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    I believe it should be -1.
    Assign -1 to unsigned char and you get 255.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Hmm...? gin's Avatar
    Join Date
    Jun 2008
    Location
    Glasgow, Scotland
    Posts
    51
    That's what I get for downloading a 'legit' version of the book.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ Primer Plus
    By curt22 in forum C++ Programming
    Replies: 14
    Last Post: 07-09-2007, 07:19 PM
  2. the errata of <<C++ Primer, 4TH>>?
    By DollfaceYY in forum C++ Programming
    Replies: 2
    Last Post: 09-13-2006, 06:10 PM
  3. C++ Primer vs. Plus
    By gL_nEwB in forum C++ Programming
    Replies: 14
    Last Post: 05-09-2006, 07:01 PM
  4. A parent's primer to computer slang
    By Magos in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 02-20-2005, 11:21 PM
  5. Cursor location and graphics primer
    By LivLuvLafLrn in forum C Programming
    Replies: 4
    Last Post: 04-16-2002, 11:12 AM