| ??? 01/03/04 01:21 Read: times |
#61804 - Pointer vs Reference Responding to: ???'s previous message |
A pointer by itself is useless, it also needs to point to a variable so a variable must also exist. That makes the pointer an unnecessary overhead, if I can have "by reference". But what actually happens when you pass by reference? Something has to be actually passed to the called code to allow it to access the referenced object - in practice, it's just a pointer by another name! There is not necessarily any need for a separate pointer - just use the 'address-of' operator in the actual parameter of the function call. Note also that an array name is effectively a "free" pointer to the array's data (ie, it consumes no additional storage to provide the pointer) |



