Thread: BitWise Newbie - Needs Urgent Help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    835
    > it just comes out -1. i don know why....

    You need to use %u to correctly print the value of an unsigned int, not %d which is for (signed) int. Try that.

    Edit: The same goes for scanf(). Study carefully the conversion characters for printf() and scanf() for unsigned vs. signed types.
    Last edited by robatino; 09-26-2007 at 12:03 AM.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Posts
    45
    Quote Originally Posted by robatino View Post
    > it just comes out -1. i don know why....

    You need to use %u to correctly print the value of an unsigned int, not %d which is for (signed) int. Try that.

    Edit: The same goes for scanf(). Study carefully the conversion characters for printf() and scanf() for unsigned vs. signed types.
    i have used %u for print f and scanf still does not work.

    when i tried the b[i] = ~b[i]

    my output is 42531145614879798456 bla bla....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bitwise Questions
    By someprogr in forum C Programming
    Replies: 8
    Last Post: 12-14-2008, 06:45 PM
  2. bitwise operations with double
    By henry_kay in forum C Programming
    Replies: 2
    Last Post: 10-03-2007, 04:57 AM
  3. Urgent homework help for NEWBIE
    By Kazasan in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2004, 04:23 PM
  4. Characters into bitwise ints
    By Code Zer0 in forum C++ Programming
    Replies: 9
    Last Post: 04-24-2003, 08:34 AM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM