0

I want to understand the syntax of the struct which i have seen some where. Can some please explain the meaning of unsigned int xyz:1;. Is it just assigning default value to a variable xyz? BTW this code is in Objective C.

struct
        {
            unsigned int xyz:1;
    } testStruct;
Abdul Samad
  • 5,748
  • 17
  • 56
  • 70

1 Answers1

2

It's a bit field. You are telling the structure that you will only be using one bit of xyz.

This allows the compiler to make packing optimisations.

Bathsheba
  • 231,907
  • 34
  • 361
  • 483