Pointer and integer addition

Doug Gwyn gwyn at smoke.brl.mil
Sat Mar 30 23:53:43 AEST 1991


In article <8334 at umd5.umd.edu> dzoey at terminus.umd.edu (Joe Herman) writes:
>fooptr = (char *) fooptr + fooptr->recsize;

This (almost) should have worked.  You also need to convert back to
the proper pointer type before the assignment:

	fooptr = (struct foo *) ((char *) fooptr + fooptr->recsize);



More information about the Comp.lang.c mailing list