Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does an asterisk (*) after a variable name mean in opengl?

I'm seeing this line in a source that I'm studying but can't seem to find anything related to "asterisk after variable" or "variable before asterisk". What does it mean?

GameDrawer* gameDrawer;

GameDrawer is also used as a name for a function and class.

like image 219
CodeSeven Avatar asked Dec 08 '22 10:12

CodeSeven


2 Answers

That would be the c++ notation for a pointer.

Source: http://www.cplusplus.com/doc/tutorial/classes/#pointers_to_classes

like image 91
bswatson Avatar answered Dec 11 '22 10:12

bswatson


Here, * is called dereference operator. This defines a pointer; a variable which stores the address of another variable is called a pointer. Pointers are said to point to the variable whose address they store.

Check here for more info.

like image 44
herohuyongtao Avatar answered Dec 11 '22 08:12

herohuyongtao