Sorry if this is dumb.
What does char*& mean, in something like
void someFunc(char*& buf, ...)
I understand char*, but what does the ampersand do here?
Sorry if this is dumb.
What does char*& mean, in something like
void someFunc(char*& buf, ...)
I understand char*, but what does the ampersand do here?
When passing an address to a function, regardless of the type of variable, the function will not work on a copy of that variable, but the actual variable itself. So when you pass a char*& to a function, you are passing it the actual char pointer, not a copy. This is useful if you want to fill an array with values, for example.
If it wasn't for C, we'd be using BASI, PASAL and OBOL.
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler