title: Why I'm getting " void value not ignored as it ought to be"?
body: <p>I am writing this program and and getting error bellow,please any one help to get out of this rid.(<a href="https://practice.geeksforgeeks.org/problems/array-of-alternate-ve-and-ve-nos/0).Or" rel="nofollow noreferrer">https://practice.geeksforgeeks.org/problems/array-of-alternate-ve-and-ve-nos/0).Or</a> can you people explain in which scenario we get this type of error.  </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include&lt;vector&gt;
  using namespace std;
  int rearrange(int array[],int N)
  {
      vector&lt;int&gt; vec1;
      vector&lt;int&gt; vec2;
      for(int i=0;i&lt;N;i++)
      {
          if(array[i]&lt;0)
          vec1.push_back(array[i]);
          else
          vec2.push_back(array[i]);
      }
      int size_vec1;
      int size_vec2;
      size_vec1=vec1.size();
      size_vec2=vec2.size();
      for(int j=0;j&lt;N;j++)
      {   
  
          if(j/2==0 || size_vec2==0 )
          {
               array[j]=vec1.pop_back();
               size_vec1-=1;
          }
          else
          {
               array[j]=vec2.pop_back();
               size_vec2-=1;
          }
  
      }
  }
  
  void print_rearrangearray(int array[],int N)
  {
      for(int i=0;i&lt;N;i++)
      {
          cout&lt;&lt;array[i]&lt;&lt;" ";
      }
  }
  int main() {
      int T;
      cin&gt;&gt;T;
      for(int i=0;i&lt;T;i++)
      {
          int N;
          cin&gt;&gt;N;
          int array[N];
          for(int i=0;i&lt;N;i++)
             cin&gt;&gt;array[i];
         rearrange(array,N);
         print_rearrangearray(array,N); 
  
      }
      return 0;
  }   
  </code></pre>
  
  <p>And I am getting the following error.</p>
  
  <pre><code>prog.cpp: In function ‘int rearrange(int*, int)’:
  prog.cpp:24:22: error: void value not ignored as it ought to be
                array[j]=vec1.pop_back();
                        ^
  prog.cpp:29:22: error: void value not ignored as it ought to be
                array[j]=vec2.pop_back();
  </code></pre>