+ 1
Please, Explain the following i found it as a quiz in a challenge. What this program is going to do and whats its working...
#include <iostream> using namespace std; typedef struct { int bit1 : 1; int bit2 : 2; int bit30 : 30; }bits; int main() { cout<<sizeof(bits); return 0; } //Output is 8 //And also explain about the output why it is 8 according to me i was thinking it should be 12 as 3 int(s) are there in the structure and what is the role of : in the structure...
6 Respostas
+ 3
actually bit field was new concept for me...
but now i got it and thanks for your help...
~ swim ~
+ 2
i also visited there to understand it
https://www.google.com/amp/s/www.geeksforgeeks.org/bit-fields-c/amp/
+ 1
still not clear... 😬