I can solve the problem using pointers. The goal is to print some stuff out
struct Nerd
{
int zitnuml;
int sc_hours;
};
int main()
{
Nerd luis;
Nerd *ptr = &luis;
ptr->sc_hours = 100;
ptr->zitnuml = 5;
cout << luis.sc_hours << endl;
cout << luis.zitnuml << endl;
}
///Why write the above if I can just do this instead:
int main()
{
Nerd luis;
luis.sc_hours=100;
luis.zitnuml=5;
cout << luis.sc_hours << endl;
cout << luis.zitnuml << endl;
}
both main function print the same thing, so why use pointers?