A field or member inside a class which allows programmers to save memory are known as bit fields. As we know a integer variable occupies 32 bits (on a 32-bit machine). If we only want to store two values like 0 and 1, only one bit is sufficient. Remaining 31-bits are wasted. In order to reduce such wastage of memory, we can use bit fields. Syntax of a bit field is as follows: type-specifier declarator: width; In the above syntax declarator is an identifier (bit-field name), type-specifier is the data type of the declarator and width is the size
The post What are Bit Fields in classes and how to access them appeared first on Coding Security.
What are Bit Fields in classes and how to access them
read more
Tidak ada komentar:
Posting Komentar