As far as I can tell I'm having B placed at CountyArray[1][0] with Ben being placed at CountyArray[1][1]. I wasn't getting back those same results. The for loop - which is there simply because I wanted to see why I wasn't getting my results - shows me this:
string CountyArray[200][1];
This is an array of 1 array of 200 strings, so CountyArray[n][1] is out of bounds.
I guess what you want is string CountyArray[200][2];
string CountyArray[200][1];
This is an array of 1 array of 200 strings, so CountyArray[n][1] is out of bounds.
I guess what you want is string CountyArray[200][2];
From what I remember, arrays start populating at 0. So an array of [n][1] allows me to write to two places - [n][0] and [n][1] with CountySize=0 being my starting point.
Was I wrong to assume that? I'm starting to think I am, and that I'm remembering it wrong, because I fixed it by making the array string CountyArray[200][2] and writing to CountyArray[n][1] and CountyArray[n][2] with the initial CountySize=1
Peter87 is correct, when you declare an array the number in the brackets is the size of the array. You declare size of 1 giving you a valid index of 0.
When you declare a multidimensional array, the number in the 'extra' subscript can be interpreted as the number of dimensions.
char array[2][1] ;
is a 2d array, with 1 dimension... it's quite meaningless.
From what I remember, arrays start populating at 0. So an array of [n][1] allows me to write to two places - [n][0] and [n][1] with CountySize=0 being my starting point.
Arrays do begin at 0. And valid indices for an array of a given size N are 0 to N-1. N, in this case, is 1. So the only valid index is 0.
An array of [n][1] size allows you to use [0 to n-1][0] as indices.