Unsigned datatype

Discussion in 'C Programming' started by prashant.khade1623, Apr 21, 2008.

  1. Hi

    When do we use unsigned data type. And what are the adantages of using
    Unsigned.
     
    prashant.khade1623, Apr 21, 2008
    #1
    1. Advertisements

  2. When dealing with non-negative integers, e.g. object
    sizes (size_t), and particularly when performing bitwise
    manipulations.
    Bure binary representation and modulo arithmetic.
     
    Peter Nilsson, Apr 21, 2008
    #2
    1. Advertisements

  3. ie. >> << | & ^ ~

    unsigned values don't overflow they simply wrap around.

    unsigned u = 0;
    u -= 1;

    u now holds the largest possible unsigned int.
     
    Nick Keighley, Apr 21, 2008
    #3
  4. Any day -except- the second Thursday or fifth Friday of the month.
    The second Thursday is kept in memory of the death of George Boole
    (Thursday Dec 8 1864); and the fifth Friday is when the
    Regional Alamgamated Philisophers And Programmers hold their
    meetings in pubs everywhere.
    It's like a membership badge; if you don't know how to use unsigned
    arithmetic then you don't get told where the next RAPAP meeting is.
     
    Walter Roberson, Apr 21, 2008
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.