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:And I'm confused about that part: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();
}
What for do we use that, if I just can writeCode:cout<< ptr->x;
instead of the pointer?Code:cout<<structure.x;