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; }
8 Answers
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;
}
+ 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?
+ 2
By using unsigned int long you can store long number
+ 1
Its just case not my problem statement
0
No its not working
0
Can you show us your code?
0
Ok
0
I can use vector