@nikhil: If i declare "Char b" after "int c".., would there be any
difference...?

On 7/28/11, Nikhil Gupta <[email protected]> wrote:
> Here's another example.
>
> struct example
> {
> int a;
> char b;
> int c;
> }
>
> Now if a variable of type example is declared then
> (considering base address as 2000)
> a gets : 2000 to 2003
> b gets : 2004
> c gets : 2005 to 2008 ? NO
>
> It gets 2008 to 2011. The bytes from 2005 to 2007 (3 bytes) are padded in
> this case.
>
> On Thu, Jul 28, 2011 at 12:18 AM, Aman Goyal <[email protected]> wrote:
>
>> yes this will be the case.
>>
>>
>> On Wed, Jul 27, 2011 at 11:35 PM, Puneet Gautam
>> <[email protected]>wrote:
>>
>>> @nikhil:So what u mean is that if i have:
>>>
>>> struct{
>>> int a;
>>> char b[5];
>>> };
>>>
>>> the size of this struct's node will be 12 not 9.., to make it a multiple
>>> of 4??
>>>
>>>
>>>
>>> On 7/26/11, Nikhil Gupta <[email protected]> wrote:
>>> > Padding is not a topic of self referential structure.
>>> >
>>> > Padding means that extra spaces of memory are used by the compiler to
>>> > allocate memory. This is done to have the memory address as a multiple
>>> of
>>> > the size of the variable. This speeds up the processing of these
>>> variables
>>> > by the compiler.
>>> >
>>> > On Tue, Jul 26, 2011 at 8:09 PM, Puneet Gautam
>>> > <[email protected]>wrote:
>>> >
>>> >> what is meant by padding in self_referenced structure?
>>> >> Is it always necessary?
>>> >>
>>> >> --
>>> >> You received this message because you are subscribed to the Google
>>> Groups
>>> >> "Algorithm Geeks" group.
>>> >> To post to this group, send email to [email protected].
>>> >> To unsubscribe from this group, send email to
>>> >> [email protected].
>>> >> For more options, visit this group at
>>> >> http://groups.google.com/group/algogeeks?hl=en.
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > Nikhil Gupta
>>> > Senior Co-ordinator, Publicity
>>> > CSI, NSIT Students' Branch
>>> > NSIT, New Delhi, India
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> Groups
>>> > "Algorithm Geeks" group.
>>> > To post to this group, send email to [email protected].
>>> > To unsubscribe from this group, send email to
>>> > [email protected].
>>> > For more options, visit this group at
>>> > http://groups.google.com/group/algogeeks?hl=en.
>>> >
>>> >
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to