[R] how to add 1 + 1 with the interface between R and C
pdalgd at gmail.com
Mon Sep 21 16:33:34 CEST 2015
> On 21 Sep 2015, at 04:03 , Cleber N.Borges <klebyn at yahoo.com.br> wrote:
> Dear useRs,
> I would like some help on how to make the sum of 1 + 1
> but using the interface between A and C.
> the function call does .call lock and close the R.
> Thank you for any help it.
Either you need a basic course in C, or you need a refresher....:
> void testfun( double *k, double *res )
> res = k + 1;
C is call by value and k and res are pointers. You need a dereferencing step or nothing with happen. Try
*res = *k + 1;
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com
More information about the R-help