I know enough that a * relates to a pointer. I’m still trying to sort that out in my head (pointers versus references.)
I’m working through a C++ book and there is a method signature in it like this:
void DrawBitmap(char *filename, int x, int y)
What does the * mean in this situation? is it accepting a pointer, or a reference to a variable?
Thanks for any help… and for putting up with an admittedly noob question.
It means that you’re passing it a pointer to a character, which usually means that pointer points to the first character in an array of characters. With a pointer (
*), you can do arithmetic, e.g. (fileName + 1) to get the second character. When you use a reference (&), you are implying that the receiving function should operate on the original data. Without the reference, the function is passed a copy, rather than the original.