What is the concept of padding?

Discussion in 'C' started by Kailash, Nov 20, 2007.

  1. Kailash

    Kailash New Member

    Joined:
    Jul 24, 2007
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Can any one tell what is the concept of padding in c and c++.

    and how much space following user defined variable will take:
    Code:
    
    struct num
    {
    int n;
    char ch;
    int p;
    }
    
    struct num
    {
    int n;
    int p;
    char ch;
    }
    
    struct num
    {
    char ch;
    int n;
    int p;
    }
    also tell me how the concept of padding is applying in these cases.
     
    Last edited by a moderator: Nov 20, 2007
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,336
    Likes Received:
    377
    Trophy Points:
    83

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice