title: Detect if a vector is a palindrome in C++
body: <p>I set myself a challenge of trying to make a program that detects if a given vector is a palindrome. Here is the code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  bool isPalindromeArray(std::vector&lt;int&gt;&amp; nums) {
      float size = nums.size()/2;
      int k = 0;
  
      if(size = int(size)) {
          for(int i = 0; i &lt; size; i++) {
              if(nums[i] == nums[nums.size() - i]) {
                  k++;
                  if(k == size) {
                      return true;
                  }
              }
          }
      } else {
          for(int i = 0; i &lt; int(size) - 1 ; i++) {
              if(nums[i] == nums[(int(size) - 1) - i]) {
                  k++;
                  if(k == int(size) - 1) {
                      return true;
                  }
              }
          }
      }
      return false;
  }
  
  int main() {
      std::vector&lt;int&gt; arr;
      arr.push_back(1);
      arr.push_back(2);
      arr.push_back(3);
      arr.push_back(2);
      arr.push_back(1);
  
      if(isPalindromeArray(arr)) {
          std::cout &lt;&lt; &quot;My Code Works&quot;;
      }
  }
  </code></pre>
  <p>When I run the code, it returns false no matter if the vector has an odd or even number of values. I have tried various troubleshooting steps but I can't seem to make it work.</p>
  <p>(MinGW64, Windows 10, VS Code)</p>