Global declaration of size giving error

When I give the size of an array as global variable the code is giving exit code -1073741571

Here’s the code

However if I use the value of MAXN directly… the code works fine…

What is it happening?

*why is it happening

hello @bishal_c
a)
in line 14 and 18 .
u should use long long also u should use < in place of <=

no it’s still giving the same exit code…

working fine in my side.

pls check

Yes…but on my machine…it’s giving that exit code…is it due the compiler flags? I have this

not sure, but logic is correct

g++ -ulimit ? is this cause ulimit causing that ?


yeah that might be creating some issue.

I updated the flags to this : !g++ -Wall -Wextra -Wno-unused-result -std=c++17 -O2 -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC

but it’s still giving the same exit code :frowning: would you see if something’s wrong there

take help of stackoverflow, i am not good with linux commands.

ur logic and code both are correct. the issue is with ur system only

Thank you :slight_smile: There was an issue with ulimit…increasing the stack size worked.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.