You don't have an infinite loop. The program simply crashs.
The origin of the crash is basically line 18. You don't need to create an array. So remove [t] everywhere.
If you want for whatever reason to keep line 18 it needs to be
student s[t + 1]; // Note + 1
otherwise using t as an index would be out of bounds. Arrays in c[++] starts with 0.
it is not legal to make a run-time array. Some compilers will do it, but its not strictly legal.
so student s[t] where t is not a constant is illegal.
also I think
student s[0] is not allowed, or problematic, and your loop does that, so even a tolerant compiler of the above issue may choke on this one.
you have global variables. These cause problems, try to write it without that.