<edited quotes>
>>>> I am calling
>>>>
>>>> int gettmp (integer *i, integer a, longint *s, longint *temp
>>>> [100], integer *fin);
>>>
>>> The temp argument has type longint **. The 100 is ignored and the []s
>>> just mean a pointer in this context.
>>>> with
>>>> longint temp [2] [100];
>>>>
>>>> gettmp (&i, a, s, temp, &fin);
>>>
>>> The type of temp here is longint (*)[100]. It's a pointer to the first
>>> of some (in this case two) arrays of 100 longints.
>>>> And advice here ?
>>>
>>> The type you need for the parameter is longint (*temp)[100]. You could
>>> write it as longint temp[2][100] if you wanted to, but I wouldn't.
>>
>> Thanks ! I changed gettmp to:
>> int gettmp (integer *i, integer a, longint *s, longint temp [][100],
>> integer *fin);
>> and now it compiles.
> I would like to put
>
> int gettmp (integer *i, integer a, longint *s, longint temp [2][100], integer *fin);
>
> But apparently that is illegal in C++.
I don't think so, but it might not mean what you think it means. The
"first" dimension is simply ignored. longint temp[2][100] is (in a
parameter position) the same as your previous solution.
Can you post code that shows what the problem is?
But I am curious as to why you want to write that 2 in there. Do you
want to write just to help the reader? If so, no problem, but if you
want to pass the 2 so the function can, for example, know the size of
the array, they you are going to have to use a different type -- the
simplest being to pass a reference to the whole array:
int gettmp(..., longint (&temp)[2][100], ...);
I think it's worth pointing out (since I think this is from your Fortran
to C++ tool) that if the array dimensions might not always be
compile-time constants you will have to start using more sophisticated
C++ types. And if that is going to happen eventually, you would be
better off starting now.
--
Ben.