DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Help with code

  1. #1
    Join Date
    Nov 2008

    Help with code

    Can someone explain me what this code does?

    char CRC[8];
    DoInvert = ('1'==BitString[i]) ^ CRC[7];
    Especially :
    For me DoInvert calculates the XOR between ('1'==BitString[i]) and CRC[7]

    Can someone help me with this?

    Thank you

  2. #2
    Join Date
    Nov 2012
    char CRC[8];

    char CRC[8] declared "CRC" as a "character variable". The [8] specifies that 8 digits are to be allocated to its memory.
    So for instance if your code later said "cin >> CRC" to which the user would define CRC, only the first 8 characters that were input would be used to define CRC's value.

    DoInvert = ('1'==BitString[i]) ^ CRC[7];

    DoInvert is exactly what it sounds like. It does the inverse of what is requested.
    ('1'==BitString[i]) is checking whether the variable "1" (which must have been declared as a variable earlier) is equal to BitString (also likely declared earlier)
    ^ CRC[7] is a mathematical function. It is the inverse of XOR. Hence why DoInvert calculates the XOR between the given values.

Similar Threads

  1. recompiling java byte code as machine code
    By javadeveloper in forum Java
    Replies: 1
    Last Post: 12-19-2007, 04:59 AM
  2. Replies: 0
    Last Post: 12-10-2005, 01:21 AM
  3. Replies: 11
    Last Post: 12-06-2000, 06:02 PM
  4. Replies: 1
    Last Post: 12-06-2000, 02:12 PM
  5. "Code Behind" = Less Spaghetti Code, MORE SCATTERED Code
    By com no spam lift in forum ASP.NET
    Replies: 1
    Last Post: 12-06-2000, 02:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center