struct init question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kaspar Minosiants

    struct init question

    Hi !

    struct A {

    int a : 1;
    int b : 2;
    char c : 3;
    };

    Could anybody explain what numbers do with filds of the struct ?

    Thanks a lot.


  • Attila Feher

    #2
    Re: struct init question

    Kaspar Minosiants wrote:[color=blue]
    > Hi !
    >
    > struct A {
    >
    > int a : 1;
    > int b : 2;
    > char c : 3;
    > };
    >
    > Could anybody explain what numbers do with filds of the struct ?[/color]

    They make them bitfields. a is one bit, b is two bits, c is three bits
    long.

    Scroll down to "What is a bitfield?"


    Please use your C or C++ textbook to look up this construct.

    --
    Attila aka WW


    Comment

    • Kaspar Minosiants

      #3
      Re: struct init question

      Thanks a lot for your replys !


      Comment

      Working...