When I call the constructor for my SegTree struct in the code below, I keep getting a non-zero exit code. When I comment out the line that initializes the struct, the program runs with no issue. Can someone explain why this is happening and how to fix my code?
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <vector>
#include <string.h>
using namespace std;
struct SegTree{
int N;
long long tree [1<<20], arr [1<<20];
SegTree(int x){ N = x; }
};
int main(){
SegTree st(len);
return 0;
}
Please help, and thanks in advance!
EDIT: My issue is not the size of the arrays, as I have mentioned in the comments. I am able to make the arrays and run the code when they are placed outside the struct.