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 firstname.lastname@example.org. 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.
- Difference between Virtual function and Pure virtual function in C++
- Bitwise AND of all the odd numbers from 1 to N
- cin get() in C++ with Examples
- Difference between Increment and Decrement Operators
- Find Kth smallest value for b such that a + b = a | b
- Map of Vectors in C++ STL with Examples
- Problem in comparing Floating point numbers and how to compare them correctly?
- exit(0) vs exit(1) in C/C++ with Examples
- Construct XOR tree by Given leaf nodes of Perfect Binary Tree
- Generating N-bit Grey Code starting from K
- Check if all bits can be made same by flipping two consecutive bits
- Maximize distance between any two consecutive 1's after flipping M 0's
- Find the sum of power of bit count raised to the power B
- Maximum XOR value of maximum and second maximum element among all possible subarrays
- Append two elements to make the array satisfy the given condition