What is the concept of padding?

Kailash's Avatar, Join Date: Jul 2007
Go4Expert Member
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 shabbir; 20Nov2007 at 17:34.. Reason: Code block
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Refer About Memory Alignment