0

If i want store 1000000000 in array so what can i do arr[100000000]

We cant insert in machine so what can i do? Example code #include <iostream> using namespace std; int main() { long long int a[1000000000],i,max; cin>>max; for(i=0;i<max;i++) { cin>>a[i]; } for(i=0;i<max;i++) { cout <<a[i]; } return 0; }

10th May 2020, 7:13 AM
Atharva Labhasetwar
8 ответов
0
#include <iostream> using namespace std; int main() { long long int a[1000000000],i,max; cin>>max; for(i=0;i<max;i++) { cin>>a[i]; } for(i=0;i<max;i++) { cout <<a[i]; } return 0; }
10th May 2020, 7:30 AM
Atharva Labhasetwar
+ 4
The stack is not big enough to store 8 gb. You should use the heap instead ( if your pc even has 8 gb of ram ) Or, just don't allocate that much for no good reason. Ever heard of vectors?
10th May 2020, 7:37 AM
Dennis
Dennis - avatar
+ 2
By using unsigned int long you can store long number
10th May 2020, 7:17 AM
A͢J
A͢J - avatar
+ 1
Its just case not my problem statement
10th May 2020, 7:30 AM
Atharva Labhasetwar
0
No its not working
10th May 2020, 7:18 AM
Atharva Labhasetwar
0
Can you show us your code?
10th May 2020, 7:23 AM
HonFu
HonFu - avatar
0
Ok
13th May 2020, 8:02 AM
Atharva Labhasetwar
0
I can use vector
13th May 2020, 8:03 AM
Atharva Labhasetwar