I came across this syntax which i have not seen before
struct A {
int x:24;
};
What does x:24 mean ? In C++ can you specify compiler that a variable should occupy only 24 bits, instead of 32 for an int type?
If yes, which 24 bits will be occupied? the left most or the right most?
This is the bit fields feature. It has been available since the early C days. Microsoft has a nice write-up on this feature, complete with pretty pictures showing the layout which is compiler-specific (they say that the pic is specific to MS).