C - converting to 2s complement

Posted by tom on Stack Overflow See other posts from Stack Overflow or by tom
Published on 2010-04-05T21:50:45Z Indexed on 2010/04/05 22:43 UTC
Read the original article Hit count: 542

Filed under:
|

I've decided to do it this way

  • flip numbers 0=1, 1=0
  • add 1 to LSB
  • if carry, loop until array[i]==0

But I'm stuck on the last point; how can I say that in a conditional loop?

© Stack Overflow or respective owner

Related posts about c

    Related posts about twos-complement