struct compare {
 int key;
 compare(int key): key(key) {}
 int operator ()(const struct StudentB& lhs, const struct StudentB& rhs) {
  return lhs.subject[key] - rhs.subject[key];
 }
};

int main()
{
 int key = 2;
 std::sort(seitoB, seitoB+sizeof(seitoB)/sizeof(seitoB[0]), compare(key));
}

とか。
スレ違い(C++)だし、試してないけど。