Re: C-pointers from Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg113119] Re: C-pointers from Mathematica*From*: Albert Retey <awnl at gmx-topmail.de>*Date*: Wed, 13 Oct 2010 12:41:03 -0400 (EDT)*References*: <i916ap$j3b$1@smc.vnet.net>

Am 12.10.2010 10:30, schrieb Bruno Silva: > Albert and Daniel, > > Thank you for your replies. > > The string pattern matching trick really does the job (and showed me several > mathematica typical expressions that I was not aware of... thanks for that > too!). > > Concerning pointer arithmetic, I haven't been programming since long but it > was an habit I acquired in the past (if I well remember, that would allow to > manage allocated memory dynamically... correct me if my wrong). dynamically allocated memory usually means that you will have to work with pointers in some way, yes. Thats because functions like malloc or calloc will return pointers. That does not mean you have to use the pointer syntax lateron, you just will have to make sure to cast to the correct type. But that is true whether you use *(p+17) or p[17]. As far as I remember, the two are absolutely equivalent, and of course the later is much easier to generate from Mathematica... hth, albert