Gongalo Ferreira wrote:
I'm not a C programmer, but I actually don't see nothing wrong
with that code...  Could you point the error out?

Ah. Took me a few moments, but...

Marco Peereboom wrote:
#include <stdio.h>
#include <stdlib.h>

struct moo {
        u_int32_t       a, b, c, d;
        char            e[44];
};

int
main(int argc, char *argv[])
{
        struct moo      m[2];
        struct moo      *p;

        p = m;

        p->a = 0;
        p->b = 1;

    /* go to next element */
        p = p + sizeof(struct moo);

Should be
  p = p + 1;
(or, rather)
  p++;


        p->a = 0;
        p->b = 1;

        return (0);
}


/Alexander

Reply via email to