Code:
#include <iostream>
using namespace std;
long ar[10];
int arraySize;
long aVeryBigSum(long arr[]) {
long total = 0;
for (int x = 0; x < arraySize; x++) {
total += ar[x];
}
return total;
}
int main() {
cin >> arraySize;
for (int x = 0; x < arraySize; x++) {
cin >> ar[x];
}
cout << aVeryBigSum(ar);
return 0;
}
Input:
5
1000000001 1000000002 1000000003 1000000004 1000000005
Visual Studio output:
705032719
Online IED output(correct):
5000000015
I have no idea what to try in this situation as different compilers are giving me different answer. Assuming its something to do with data type long