It should happen in all scenarios, I think. because offset will give us 
the current elements position in the list of a structure and sizeof will 
give us the total size of the data items in the structure.

sizeof(struct sample) should always be equal to 'offsetof(struct sample, 
last) + sizeof(char)', since last's data type is 'char'.

thanks,
uma..

Saifi Khan wrote:
> Hi all:
>
> Please forgive me, if this sounds like a basic question.
>
> Consider this simple C struct
>
>   struct sample
>   {
>      int *p;
>      char c;
>      ...
>      char last;
>   }
>
> In what scenarios,
>     sizeof(struct sample) != offsetof(struct sample, last)
>
> Thanks in advance.
>
>
> thanks
> Saifi.
>

Reply via email to