xor (was fgets)

This is a discussion on xor (was fgets) within the C Programming forums, part of the General Programming Boards category; Code: 101011 XOR 110101 ------ i think it's 100001 just thought i'd post something completely random because this topic is ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Code:
        101011
    XOR 110101
        ------
    i think it's

    100001


    just thought i'd post something completely random because this topic is boring.

    im a retard

    i think its 11110
    Last edited by Brian; 08-18-2002 at 08:43 PM.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >i think its 11110
    011110

    -Prelude
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Location
    Vancouver
    Posts
    2,220
    Okay, can someone please clarify how XOR works?

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Okay, can someone please clarify how XOR works?
    If both of the bits compared are the same then the resulting bit is 0, if the bits being compared are different then the resulting bit is 1.
    Code:
        101011
    XOR 110101
        ------
        011110
    
    0 ^ 0 = 0
    1 ^ 1 = 0
    1 ^ 0 = 1
    0 ^ 1 = 1
    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fgets not working after fgetc
    By 1978Corvette in forum C Programming
    Replies: 3
    Last Post: 01-22-2006, 06:33 PM
  2. problem with fgets
    By learninC in forum C Programming
    Replies: 3
    Last Post: 05-19-2005, 09:10 AM
  3. problem with fgets
    By Smoot in forum C Programming
    Replies: 4
    Last Post: 12-07-2003, 03:35 AM
  4. fgets crashing my program
    By EvBladeRunnervE in forum C++ Programming
    Replies: 7
    Last Post: 08-11-2003, 01:08 PM
  5. help with fgets
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 10-17-2001, 09:18 PM

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