Dynamically allocated string array, then change it’s value?

You’re accessing memory beyond the range of the allocated array

users = new string[seatNum];
users[seatNum] = name;

The first element is [0]. The last is [seatNum-1]

Leave a Comment