file isn't reading into 2d string array

I've got a file, and what I believe to be a 2d string array and it isn't writing in anything. I know I'm doing something wrong. Please help.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  string studentDATA[151][2];

	int looper = 0, secondary;
	while (looper < 150)
	{
		for (secondary <= 3; secondary = 0; secondary++)
		{
			getline(in, studentDATA[looper][secondary]);
			in >> studentDATA[looper][secondary];
		}

		looper++;
	}
Valid indexes for an array of size n are 0 to n-1. So when secondary is 3, it is not a valid index. The condition in the for loop will always evaluate to false (= is assignment) which is fortunate, since otherwise you would have an infinite loop of undefined behavior, instead of your not-a-loop with undefined behavior.
Topic archived. No new replies allowed.