CHAR_BIT : It is the number of bits in char. These days, almost all architectures use 8 bits per byte (But it is not the case always, some older machines used to have 7-bit byte). It can be found in
Let us see an application of it. Suppose we wish to print byte by byte representation of an integer.
Input : 4 Output : 00000000 00000000 00000000 00000100 Input : 12 Output : 00000000 00000000 00000000 00001100
00000000 00000000 00000000 00001100
This article is contributed by Apurva Agarwal. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Generate first K multiples of N using Bitwise operators
- How to iterate over the elements of an std::tuple in C++
- Largest possible value of M not exceeding N having equal Bitwise OR and XOR between them
- Queries to find the Lower Bound of K from Prefix Sum Array with updates using Fenwick Tree
- Sum of bit differences for numbers from 0 to N | Set 2
- Bitwise operations on Subarrays of size K
- How to access private/protected method outside a class in C++
- Find a number M < N such that difference between their XOR and AND is maximum
- lvalues references and rvalues references in C++ with Examples
- Difference between cout and std::cout in C++
- C++ program to check whether a String is a Pangram or not
- Difference between pair in Multiset and Multimap in C++ STL
- How does Volatile qualifier of C works in Computing System
- How to use unordered_map efficiently in C++
- Count of binary strings of length N having equal count of 0's and 1's and count of 1's ≥ count of 0's in each prefix substring