Code are not executed after a function call in C++

  c++, visual-studio-code

All the codes are running fine, but after making a function call that takes two vectors, the codes which are written after the function is not running, compiler is not even throwing any error.

void fun(vector<int> nums1, int m, vector<int> nums2, int n){
    int i=0;
    int j=0;
    while(i<m or j<n){
        if(nums1[i] > nums2[j]){
            int temp = nums1[i];
            nums1[i] = nums2[j];
            nums2[j] = temp;
            i++; 
        }
        else if(nums1[i]<=nums2[j]) i++;
    }

    while(j<n){
        nums1.push_back(nums2[j]);
        j++;
    }
    
   
}

After this function, no other function is running.

    vector<int> nums1;
    vector<int> nums2;
    int m; cin>>m;
    for(int i=0; i<m; i++){
        int k;
        cin>>k;
        nums1.push_back(k);
    }
    int n; cin>>n;
    for(int i=0; i<m; i++){
        int k;
        cin>>k;
        nums2.push_back(k);
    }
   

    fun(nums1,m,nums2,n);
    

    cout<<"last"<<endl;

I am not getting the last code output.

Source: Windows Questions C++

LEAVE A COMMENT