20231105 - 结构体02
奇奇怪怪的错误
在 g++ 编译器下, 如下代码 有概率 会在 Clion 中异常退出
cpp
#include <iostream>
using namespace std;
struct Student {
short id;
short score;
};
int main() {
int n;
cin >> n;
Student students[n];
for (int i=0; i < n; i++) {
cin >> students[i].id >> students[i].score;
}
for (int i=0; i < n; i++) {
cout << students[i].id << " " << students[i].score << endl;
}
}