How can I store million objects into array without error? I'm playing with a 3dEngine in C++ , all works nice and fast but i can't add more than 50K Objects . Object contains 3 vector and colors and some useful method . Some Help ?
#include <iostream>
using namespace std;
class Myc{
    public:
    double x,y,z;
    Myc(double _x=0 ,double _y=0,double _z=0){
        x=_x;y=_y;z=_z;
    }
};
int main(){
    int i; 
    int N=151000;
    Myc pts[N];
    for (i=0;i<N;i++){
        pts[i] = Myc(1,1,1);
    }
    
    cout << pts[999].x <<endl;
    return 0;
}
output:
1                                                                                                                                                                                                                                                                                                                                                                              
...Program finished with exit code 0 
But using int N=1151000;
the output is :
Segmentation fault (core dumped)   
How can I store million objects into array without error? Thanks .

 
     
     
    