Re: Passing address of multidimentional array

Tech-Archive recommends: Speed Up your PC by fixing your registry



Doug Harrison [MVP] wrote:

All the following are equivalent:


void f(int a[20][30]);

void f(int a[2][30]);

void f(int a[][30]);

void f(int (*a)[30]);


This is the *****only***** context in which array and pointer
declaration syntax is sort of interchangeable, and it's the reason
the magnitude of the first dimension doesn't matter - all four
declare "a" to be a pointer to an array of 30 ints.

No - they are still different with all consequences. For example array
declarators (the first three) are not modifiable lvalues, while the last
declarator is.

So it is impossible to use ,,a = sth;''

-- best regards

Cezary Noweta
.



Relevant Pages

  • Re: Passing address of multidimentional array
    ... declaration syntax is sort of interchangeable, ... the magnitude of the first dimension doesn't matter - all four ... I think Cezary meant to imply that the assignment in 'foo' below is supposed to fail for some reason: ... Of course, since the two declarations are equivalent ('foo' and 'bar' have the same type, essentially), there is no error on line 4. ...
    (microsoft.public.vc.language)
  • Re: Passing address of multidimentional array
    ... declaration syntax is sort of interchangeable, ... the magnitude of the first dimension doesn't matter - all four ...
    (microsoft.public.vc.language)
  • Re: Well stone ya til the.....
    ... Doesn't matter one way or the other to the point. ... The reason your declaration is nonsensical is it depends on the ... Crucial assets, most ...
    (alt.guitar.amps)
  • Re: Beethoven Symphonies: List of Best Recordings of Each?
    ... Is this a protest of English spelling peculiarities, a declaration of ... agnosticism about the matter, or just a typo:) ...
    (rec.music.classical.recordings)
  • Re: indentation - unbalanced parentheses
    ... It would even have been better if source form were selected ... by a declaration or assertion within the source itself. ... a matter of habit, people would simply begin each source file ...
    (comp.lang.fortran)