Code:
#include <iostream>
using namespace std;

struct account
{
	account();
	int accountnum;
	float balance;
	float interestrate;
};

account::account()
{
	accountnum = 50;
}

struct account2
{
	account2();
	account * data;
	void test();
};

account2::account2()
{
}

void account2::test()
{
	data->accountnum = 1000;
}

int main()
{
	account test;
	account2 test2;
	cout << test.accountnum << endl;
	test2.test(); //Error
	cout << test.accountnum << endl;
	return 0;
}
I have the following code. It contains two structs, account and account2.

I want to change the value of accountnum of account using a pointer in account2. However when I run the program it will keep on crashing. Please tell me what is wrong with this code and how I could fix it.