I'm trying to understand the following code in C:
struct values{
int i:3;
int j:3;
int k:2;
};
int main(){
struct values v = {-6,2,5};
printf("%d %d %d", v.i,v.j,v.k);
}
This code produces the following output:
2 2 1
I'm trying to understand what does it mean the assignment for int
values used inside the struct i.e.: int i:3
?
I know that : is not an operator. So what does it do? Also, can someone explain how this output is achieved?
Thanks very much!