Hey Guys,
Im having a spot of trouble with dynamic memory allocation and any help would be appreciated.
My problem is the I have 2 classes Bank and Account and I am making a dynamic array of the Account member variables. Everything seems to work fine until I try to dynamically allocate the array and the program crashes.
//acc.h
class Account{
private:
//Declaring class member variable
char *customer; //251 including null byte
char accountNumber[20 + 1]; //16 including null byte
int balance;
....
};
//bank.h
class Bank{
private:
Account *savings;
int arraySize;
...
Bank{name[]);
};
///In the bank class constructor.
savings = new Account[arraySize];
I know my syntax is correct I just cant figure out whats wrong.
PS. THis is not the whole code as its about a 1000 lines so if you want I can PM it.
Thanks in advance.