Skip to content
Prev 16668 / 63424 Next

1-based arrays and copying vectors

On 6/19/05, Rob Lopaka Lee <rlee at inverness.fpcc.net> wrote:
If the C code can be relied upon to ignore the zero'th element of the
array then write a wrapper that gets the array, say int v[], from R
and passes &v[-1] to your C code.  That has the effect of shifting all
the addresses back by one position.
In C you could use the memcpy function or the Memcpy macro defined in
<R_ext/RS.h>.