can array call by reference??

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???
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.
void add( char (&id)[][9] )

would give you a reference to an array.


Topic archived. No new replies allowed.