Does C have a #include<bitset>
similar to C++ ? I have been looking for the past week. I can't find a equivalent directive preprocessor!
Asked
Active
Viewed 396 times
1

Nicol Bolas
- 449,505
- 63
- 781
- 982

jerry denis inyang
- 21
- 5
-
3No, there is no *standard* header for this. – Eugene Sh. Aug 21 '20 at 20:16
-
8That would be hard to do considering C doesn't have templates. – NathanOliver Aug 21 '20 at 20:16
-
Probably the closest thing in C is the built-in bitwise operators (eg bool isThirdBitSet = ((someVal & (1<<2)) != 0); ) – Jeremy Friesner Aug 21 '20 at 20:18
-
There are some third-party header-only libraries you can find on GitHub, I am not aware of any standard headers. – Mansoor Aug 21 '20 at 20:19
-
This answer: https://stackoverflow.com/a/263738/5754656 (and other answers to that question) might be helpful – Artyer Aug 21 '20 at 22:38
1 Answers
1
No, it does not. There are, however, ways to implement what you are looking for (or at least some sort of approximation). Take look at: http://c-faq.com/misc/bitsets.html - I think it is going to be useful.

Konrad Zapałowicz
- 271
- 1
- 4