savings = new Account[arraySize + 10];
while(k <= arraySize + 10){
strcpy(savings[k].accountNumber, temp[k].accountNumber);
savings[k].balance = temp[k].balance;
strcpy(savings[k].customer, temp[k].customer);
k++;
}
assume 'arraySize' = 5 so savings is an array of length 15. say savings[15], which means savings can go from savings[0]-savings[14]. In the while loop you have k<=15, which means k=15 is valid value, so you try to access savings[15] which is trying to access undefined memory.
Reputation Points: 431
Solved Threads: 116
Practically a Master Poster
Offline 654 posts
since Dec 2007