Segfaults usually happen when you try to illegally access memory.
Here, it's because your student array is an undefined size, since the students variable is junk when you create the array. You could be accessing an out-of-bounds element in the loop. Could be is the phrase to watch out for here; you have undetermined behaviour and that's not good. :-S
If you don't know the size of your array until runtime, your best bet is to use a std::vector. You can dynamically allocate arrays but it's not a great solution.