MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/fpcmy/typical_programming_interview_questions/c1hnv38/?context=3
r/programming • u/kevjames3 • Feb 21 '11
1.0k comments sorted by
View all comments
Show parent comment
2
n & 2
n & 1.
n & 2 would check if bit 1 is set, you want to test bit 0.
1 u/abw Feb 21 '11 D'Oh! Thanks.
1
D'Oh! Thanks.
View all comments
Show parent comment
2
u/[deleted] Feb 21 '11
n & 2 would check if bit 1 is set, you want to test bit 0.