Error in code of large number factorial (Segmentation Fault (SIGSEGV))

void multiply(int n,vector& v){
int carry=0;
int p=0;
for(int i=0;i<v.size();i++){
p=v[i]*n+carry;
v[i]=p%10;
carry=p/10;
}

    while(carry!=0){
        int temp=carry/10;
        v.push_back(temp);
        carry=carry/10;
    }
}
vector<int> factorial(int N){
    // code here
    vector<int> v;
    v.push_back(1);
    for(int i=2;i<=N;i++){
        multiply(i,v);
    }
}

it is giving Segmentation Fault (SIGSEGV) error
idk why

Please either format your code (all of it, please!) or (better!) link to your submission - the forum software has mangled it and it won’t compile! :slight_smile:

And please link to the Problem you’re trying to solve.