I am wondering

Hi ! I am wondering what -> means ? Is it some kind of pointer? Then when do you use it cause in a code there were a -> and I changed it with a * pointer and it didn't work xD..

So what is it and when are you suppose to use it?
-> is like using . for pointers to classes
eg:
1
2
3
4
5
6
7
8
9
10
11
struct S
{
   int member;
};

int main()
{
    S* ptr = new S;
    ptr->member = 8;
    (*ptr).member = 8;
}

Both lines 9 and 10 have the same meaning
If you don't understand how to use -> then I wouldn't be using pointers. Your opening yourself up a whole raft of memory management issues you don't understand yet.

Read some tutorials on dynamic memory allocation, dynamic object creation and object orientated development to get a good grounding in how they are used correctly.
Thanks for the reply , I will start reading about it
Topic archived. No new replies allowed.