i need to pass an array as pass-by-reference, but the following code gives me an error:
anyone know how to get around this? anything would be appreicated.Code:int openfile(char& []);
thanks!
i need to pass an array as pass-by-reference, but the following code gives me an error:
anyone know how to get around this? anything would be appreicated.Code:int openfile(char& []);
thanks!
when you pass by reference, you only need...
Code:int openfile(char&);
hasafraggin shizigishin oppashigger...
Arrays are passed by reference (using a pointer) by default so I don't see why you'd need to explicitly use reference syntax. What you're trying to do with the above code is pass an array of references (illegal). I'm not sure if this syntax is correct as I've never needed to do it, but you could try -
int openfile(char (&array)[50]);
You'd need to specify the size of the array doing it like this, as references aren't as flexible as pointers.
thanks, sorensen. ill try that.