[futurebasic] Re: [FB] Fortran and C to FB

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: Rick Brown <rbrown@...>
Date: Sat, 22 May 1999 21:15:03 -0500

> <SNIP>
> >How do the above relate to the below that were also in that post, seems I
> >am missing a pxyz and v array(s), or am I? What are the below statements
> >doing exactly with regards to the above?

One of the the subleties of C is that an "array" and a "pointer" are more or
less interchangeable.  If you declare an array, you can use the array's name as
a pointer to (the first element of) the array.  Conversely, if you declare a
pointer, you can use it later with a subscript after it, and this will refer to
the n-th structure past the address that the pointer points to.  This is a
weird concept, if you're used to a language in which pointers and arrays are
two very different things.

Consequently, sometimes you'll often see a variable in C declared as a pointer,
accompanied by some comment that refers to it as an array.  In FB, maybe the
closest analog to this kind of dual-natured thing is the XREF concept--although
90% of the time you can probably emulate the C algorithm without actually
resorting to XREF's, once you understand what it's doing.

- Rick