quick cpp syntax question =)

Discussion in 'Programming' started by mudanoman, Apr 22, 2007.

  1. #1
    Hey,

    I am curious can anyone help explain this line of code:

    bits = (c & 0x80) ? 1 : 0;

    Thanks!
     
    mudanoman, Apr 22, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    If this condition: c & 0x80 is true, then the value of bits is 1, and 0 otherwise. It's basically like a one-line if/else handle method.
     
    nico_swd, Apr 22, 2007 IP
  3. mudanoman

    mudanoman Guest

    Messages:
    596
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks Nico!
     
    mudanoman, Apr 22, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135