can array call by reference??

Dec 7, 2008 at 1:16am
closed account (o2TCpfjN)
i written a function

void add(char& id[][9],int a ,char &year[][2],int b,char &name[][26],int c ,char &pg[][6],int d)

when i run the program ,the program said that
declaration of 'id' as array of references

what wrong is it???
Dec 7, 2008 at 3:05am
That's one of the rules of references. You just can't have an array of references. Period.
References need to initialized when they are declared, otherwise they're invalid. Arrays need to have their elements uninitialized at some point. Therefore, the two concepts are incompatible.
Dec 7, 2008 at 2:53pm
void add( char (&id)[][9] )

would give you a reference to an array.


Topic archived. No new replies allowed.