- what is this...???

Started by
2 comments, last by Nypyren 16 years, 6 months ago
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!
Advertisement
operator-> is used to access members through a pointer:

class obj{public:int member;}int main(){obj *object = new obj();//access member of objectobject->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.
"->" 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.
You can reverse the arrow, but then the compiler sees:

x < -y

x less than negative y

This topic is closed to new replies.

Advertisement