The ASCII NUL and zero are represented as 0x00 and 0x30 respectively. An ASCII NUL character serves as sentinel characters of strings in C/C++. When the programmer uses ‘0’ in his code, it will be represented as 0x30 in hex form. What will be filled in the binary representation of ‘integer’ in the following program?
char charNUL = '\0'; unsigned int integer = 0; char charBinary = '0'; |
The binary form of charNUL will have all its bits set to logic 0. The binary form of integer will have all its bits set to logic 0, which means each byte will be filled with NUL character (\ 0). The binary form of charBinary will be set to binary equivalent of hex 0x30.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Rated as one of the most sought after skills in the industry, own the basics of coding with our C++ STL Course and master the very concepts by intense problem-solving.
Recommended Posts:
- Integer literal in C/C++ (Prefixes and Suffixes)
- Raw string literal in C++
- accumulate() and partial_sum() in C++ STL : numeric header
- numeric header in C++ STL | Set 2 (adjacent_difference(), inner_product() and iota())
- Split numeric, alphabetic and special symbols from a String
- <numeric> library in C++ STL
- Pointers in C and C++ | Set 1 (Introduction, Arithmetic and Array)
- fesetround() and fegetround() in C++ and their application
- Queries to insert, delete one occurrence of a number and print the least and most frequent element
- Get first and last elements from Array and Vector in CPP
- Similarities and Differences between Ruby and C++
- Generate an array of given size with equal count and sum of odd and even numbers
- Similarities and Difference between Java and C++
- INT_MAX and INT_MIN in C/C++ and Applications
- Change/add only one character and print '*' exactly 20 times
- Comma in C and C++
- How does "void *" differ in C and C++?
- What are the operators that can be and cannot be overloaded in C++?
- Data type of character constants in C and C++
- Can we use function on left side of an expression in C and C++?

