What is the error here?

when I use Global array then it works fine… but when I declare the array of size N = 1000005 in the main function then it’s not working…

hello @abhi542136

genral in global scope we can declare comapratively larger array than the function

because for function memory is allocated over stack whereas all global variables are allocated at data segment

1 Like

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.