Jump to content
  • Advertisement
Sign in to follow this  

- what is this...???

This topic is 4035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok working on a little sprite animation in allegro for the first time. Acording to my reading material i have to build my own data structures to simulate my own animations. Ok here's the part i don't know. In the sample code the use this symbol: -> OK I know for a fact this already looks like a total noob quest on my part but what does this do exaclty? Also can i change the direction? <- thanks in advance!

Share this post

Link to post
Share on other sites
operator-> is used to access members through a pointer:

class obj
int member;

int main()
obj *object = new obj();
//access member of object
object->member = 1;
delete object;
return 0;

Similarly, you could dereference the pointer and use operator.:
(*object).member = 1;

And no, <- is not a valid operator.

Further reading.

Share this post

Link to post
Share on other sites
"->" Is use to access an element of a class or struct via a pointer.

For example:

struct foo{
int a;


foo* f = new foo;

// You can write:
foo->a = 10;
// Or you can write:
(*foo).a = 10;

And to your second question, no you cannot reverse the arrow.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!