Hey, I'm reading now a C++ tutorial from cprogramming.com, lesson about a structures. And I see now and example of pointers in structures:
Code:
#include <iostream>
using namespace std;

struct xampl {  
    int x;
};

int main()
{
   xampl structure;
   xampl *ptr;
   structure.x = 12;
   ptr = &structure;
   cout<< ptr->x;
   cin.get();                    
 }
And I'm confused about that part:
Code:
 cout<< ptr->x;
What for do we use that, if I just can write
Code:
cout<<structure.x;
instead of the pointer?