#include <iostream>
#include <string>
usingnamespace std;
struct Employee
{
unsignedint age;
unsignedint salary;
};
int main()
{
Employee emp1; //Here we create a new instance of the Employee structure
emp1.age = 24; //We set the age
emp1.salary = 10000; //And the salary
Employee *ptr = &emp1; //We create a pointer of type Employee and point it to the memory address of emp1.
cout << "Age of emp1: " << ptr->age << endl; //We can't use ptr.age, we need to use ptr->age
cout << "Salary of emp1: " << ptr->salary << endl; //-> takes what is in the memory address of salary
//Note: If not working with pointers like emp1 we do: emp1.age but if its a pointer to a struct we do ptr->age.
return 0;
}