A
Alejo
Hello,
My implementation does not define offsetof, so I have designed a little
program that 'attempts' to find the relative position of a member in its
structure. It just does not work.
Could I get some pointers on what I am doing wrong (apart from being coding
so late at night).
#include <stdlib.h>
#include <stdio.h>
int main( void )
{
struct new
{
int a;
char b;
char c;
} x;
size_t num;
num = (size_t)((struct new *)&x.c - &x);
printf( "%u\n", num );
return EXIT_SUCCESS;
}
It always returns 0.
Thanks.
My implementation does not define offsetof, so I have designed a little
program that 'attempts' to find the relative position of a member in its
structure. It just does not work.
Could I get some pointers on what I am doing wrong (apart from being coding
so late at night).
#include <stdlib.h>
#include <stdio.h>
int main( void )
{
struct new
{
int a;
char b;
char c;
} x;
size_t num;
num = (size_t)((struct new *)&x.c - &x);
printf( "%u\n", num );
return EXIT_SUCCESS;
}
It always returns 0.
Thanks.