From tpapp at Princeton.EDU  Sat Nov 18 18:54:39 2006
From: tpapp at Princeton.EDU (Tamas K Papp)
Date: Sat, 18 Nov 2006 12:54:39 -0500
Subject: [Rd] array indexes in C
Message-ID: <20061118175439.GA20933@pu100877.student.princeton.edu>

I am passing (numeric) arrays to a C function, called with .C.  To the
best of my knowledge, I can do this in R by passing it as a vector
(with as.vector) to the .C call.

However, it would be useful to access the array as an array inside C,
ie not have to calculate how array indices (i,j,k) map to the vector
elements.  What is the right way to do this?  Are there convenience
functions to do the index calculations (knowing the dimensions) that I
could call?

In the C99 standard, I have seen something about flexible arrays, I
don't know if that would help here.

Thanks,

Tamas



[Rd] array indexes in C
Tamas K Papp