Is there any problem with the code .
Why this code is generating all offsets as 28.
#include<stdlib.h>
#define offsetof( T , M ) (( size_t )(( char *)&(( T *)0) ->r - \
(char *)(T *) 0))
int main(void)
{
struct STU {
char name[20];
struct DATE {
short day ; short month ; short year ;
}D;
int r ;
};
size_t pos = offsetof( struct STU , name[0] );
printf(" pos name[0] = %d ", pos );
pos = offsetof( struct STU , r );
printf(" pos r = %d ", pos );
pos = offsetof( struct STU , D.month );
printf(" pos month = %d ", pos );
pos = offsetof( struct STU , D.year );
printf(" pos year = %d ", pos );
return 0;
}