Help with code


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Help with code

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    25

    Help with code

    Can someone explain me what this code does?

    Code:
    char CRC[8];
    DoInvert = ('1'==BitString[i]) ^ CRC[7];
    Especially :
    Code:
    ('1'==BitString[i])
    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
    Posts
    1
    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, 03:59 AM
  2. Replies: 0
    Last Post: 12-10-2005, 12:21 AM
  3. Replies: 11
    Last Post: 12-06-2000, 05:02 PM
  4. Replies: 1
    Last Post: 12-06-2000, 01: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, 01: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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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