What Does '*' Mean?
When declaring certain variables, it seems that you have to add a * at the end of the type, for example :
SDL_Surface* mainScreen;
What does that asterisk do?
it means POINTER
so this variable can store an address of another variable (or structure in this case) of the same type.
read more here: http://www.cplusplus.com/doc/tutorial/pointers.html
so this variable can store an address of another variable (or structure in this case) of the same type.
read more here: http://www.cplusplus.com/doc/tutorial/pointers.html
* have a couple of meanings depending on when and how it is used.
int * ptr_mine; means you are creating a pointer to an int.
int c = *ptr_mine, mean you are depreicating the pointer, getting the value that the pointer points to and not the value of the pointer itself.
In your case SDL_Surface* mainScreen; is a pointer to the type SDL_Surface, remember a pointer is just a memory address that "point" the variable you are using, it is NOT the variable
theTroll
int * ptr_mine; means you are creating a pointer to an int.
int c = *ptr_mine, mean you are depreicating the pointer, getting the value that the pointer points to and not the value of the pointer itself.
In your case SDL_Surface* mainScreen; is a pointer to the type SDL_Surface, remember a pointer is just a memory address that "point" the variable you are using, it is NOT the variable
theTroll
Quote:Original post by TheTroll
int c = *ptr_mine, mean you are depreicating the pointer, getting the value that the pointer points to and not the value of the pointer itself.
You mean dereferencing, I think. To "deprecate" is the gradual phasing-out of obsolete functionality.
Yeah that is what I ment. It has been many years since I took a class in C, guess my terms are a little messed up.
theTroll
theTroll
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement