Structure padding

Discussion in 'C Programming' started by 123music, Apr 13, 2010.

  1. 123music

    123music

    Joined:
    Apr 13, 2010
    Messages:
    1
    Hi All...

    In C structures compiler will be padding extra bytes. How it is detected by the compiler?

    struct
    {
    char a;
    int b;
    }

    Here 3 bytes are padded (in VC++) after char a..
    How compiler has detected it..How does it know that it has to add 3 bytes??

    Can anyone give me an example how compiler exactly detects it..

    Thanks...
     
    123music, Apr 13, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Amarendra

    Structure padding.

    Amarendra, Jun 21, 2004, in forum: C Programming
    Replies:
    13
    Views:
    9,601
    Ralmin
    Jun 22, 2004
  2. phoenix

    structure padding

    phoenix, Mar 11, 2005, in forum: C Programming
    Replies:
    1
    Views:
    419
    Peter Nilsson
    Mar 11, 2005
  3. junky_fellow@yahoo.co.in

    padding between variables in a structure

    junky_fellow@yahoo.co.in, May 17, 2005, in forum: C Programming
    Replies:
    6
    Views:
    473
    Flash Gordon
    May 18, 2005
  4. Stephen Mayes

    structure padding

    Stephen Mayes, May 20, 2005, in forum: C Programming
    Replies:
    5
    Views:
    448
    Dave Thompson
    May 31, 2005
  5. Kislay

    Size of a structure : Structure Padding

    Kislay, Oct 1, 2007, in forum: C Programming
    Replies:
    15
    Views:
    976
    clinuxpro
    Jul 13, 2011
Loading...

Share This Page