#include <iostream>
using namespace std;
int main(){
int N,unit_distance,total_distance,gas_number,sum_of_distance,giant_number,temp;
bool reach;
cin >> N;
for (int all=0;all<N;all++)
{
reach =true;
sum_of_distance=0;
cin >> unit_distance >> total_distance >> gas_number;
int gas[gas_number+1];
for (int i=0;i<gas_number;i++)
cin >> gas[i];
gas[gas_number] = total_distance;
// cin >> giant_number;
}
return 0;
}
This is part of my code for a question. The problem is that the line "cin >> giant_number" is causing runtime error on the Online Judge, as long as this line is removed the code can run successfully without runtime error. I just really cannot understand why a single "cin" code can cause runtime error. Meanwhile, the problem doesn't exist when I run it in Xcode.