Segmentation fault

i am getting segmentation fault when trying this problem , please help me resolve issue

below is the link of my code

The 500,000th prime is 7,368,787
so run your loop atleast upto this no

Modified Code

if you want to ask something about this feel free to ask
i hope this helps
if yes show your response with :heart: and don’t forgot to mark doubt as resolved

still getting segmentation fault

you check the modified code??

you have make one more mistake

 if(a [i] == true){
            primes.push_back(i);
            for(ll j = i*i; j < 7400000; j += i){
                a[j] = false;
            }
        }

you have swap the true and false condtions
this is correct one

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.