Garmin Interview Question

Flip a bit in a uint32 using C.

Interview Answers

Anonymous

Aug 2, 2012

For those not familiar with C, I believe teh following should work: //This is using the Exclusive Or(XOR) operator unsigned flipBit ( unsigned x, unsigned bit ) { return x ^ (1UL << bit);4. }

1

Anonymous

Aug 2, 2012

Reposted as I left a 4. in there that should not be. For those not familiar with C, I believe the following should work: //This is using the Exclusive Or(XOR) operator unsigned flipBit ( unsigned x, unsigned bit ) { return x ^ (1UL << bit); }

1

Anonymous

Mar 11, 2012

If you don't know how to do this, you didn't go to computer science 101 class.

1