+ 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...

15th May 2019, 2:32 PM
Sp Maurya
Sp Maurya - avatar
6 odpowiedzi
+ 3
actually bit field was new concept for me... but now i got it and thanks for your help... ~ swim ~
15th May 2019, 4:20 PM
Sp Maurya
Sp Maurya - avatar
15th May 2019, 4:23 PM
Sp Maurya
Sp Maurya - avatar
+ 1
still not clear... 😬
15th May 2019, 3:19 PM
Sp Maurya
Sp Maurya - avatar