I was recently asked in an interview how to set the 513th bit of a char[1024] in C, but I’m unsure how to approach the problem. I saw How do you set, clear, and toggle a single bit?, but how do I choose the bit from such a large array?
I was recently asked in an interview how to set the 513th bit of
Share
…making certain assumptions about character size and desired endianness.
EDIT: Okay, fine. You can replace
8withCHAR_BITif you want.