The problem is that the program does not print any values when using the pointer, I searched a lot and there seems to be no solution. any ideas?
#include <iostream>
using namespace std;
struct Brok{
string name;
int age;
void pt(){
cout << "Name : " << name << "\nAge : " << age;
}
};
int main()
{
Brok *a1;
a1->name = "John Wick";
a1->age = 46;
a1->pt();
return 0;
}
Output:
...Program finished with exit code 0
Press ENTER to exit console.