int s: 3 ; declaration in structure is possible

This is a discussion on int s: 3 ; declaration in structure is possible within the C Programming forums, part of the General Programming Boards category; Code: #include<stdio.h> struct a { int s: 3; }; int main() { struct a a1; printf("%d \n",a1.s); return 0; } ...

  1. #1
    kotin
    Join Date
    Oct 2009
    Posts
    132

    int s: 3 ; declaration in structure is possible

    Code:
    #include<stdio.h>
    struct a
    {
    int s: 3;
    };
    
    int main()
    {
    struct a a1; 
    printf("%d \n",a1.s);
    return 0;
    }

    is there any use by defining int s: 3; with this systax program is compiling and linking.

    wts the inner secret of this systx int s:3

    i can apreciate any replys

  2. #2
    DESTINY BEN10's Avatar
    Join Date
    Jul 2008
    Location
    in front of my computer
    Posts
    804
    Google bit fields for that.
    HOPE YOU UNDERSTAND.......

    By associating with wise people you will become wise yourself
    It's fine to celebrate success but it is more important to heed the lessons of failure
    We've got to put a lot of money into changing behavior


    PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
    IDE- Microsoft Visual Studio 2008 Express Edition

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    399
    It's a bit field: C Bit Fields (C)

  4. #4
    kotin
    Join Date
    Oct 2009
    Posts
    132
    Thanks for your replys

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. NEED HELP READING FILE and PRINTING
    By geoffr0 in forum C Programming
    Replies: 4
    Last Post: 04-16-2009, 06:26 PM
  2. Game Won't Compile
    By jothesmo in forum C++ Programming
    Replies: 2
    Last Post: 04-01-2006, 04:24 PM
  3. Replies: 2
    Last Post: 03-24-2006, 08:36 PM
  4. My graphics library
    By stupid_mutt in forum C Programming
    Replies: 3
    Last Post: 11-26-2001, 06:05 PM
  5. A Simple (?) Problem
    By Unregistered in forum C++ Programming
    Replies: 8
    Last Post: 10-12-2001, 05:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21