title: How to return boolean in a function?
body: <p>I wanted to compare two arrays. I have set a variable as true and it gets false, when any element in an array does not match. I want to return that variable, which is a boolean, but it does not return that. Why is that?</p>
  <pre><code>bool compare_arr(int arr1[], int len_arr1, int arr2[] ,int len_arr2){
      cout &lt;&lt; &quot;Compare the two Arrays&quot;&lt;&lt; endl;
      bool result = true;
  
      for(int x = 0; x &lt; len_arr1; x++)
      {
          if(arr1[x]==arr2[x])
          {
              continue;   
          }
          else
          {
              result = false;
              break;
          }
      }
      
      return result;
  }
  
  int main()
  {
      int arr1[] = {1,2,3,4};
      int len_arr1 = sizeof(arr1)/sizeof(arr1[0]);
  
      int arr2[] = {1,2,3,4};
      int len_arr2 = sizeof(arr2)/sizeof(arr1[0]);
  
      compare_arr(arr1,len_arr1,arr2,len_arr2);
          
      return 0;
  }
  </code></pre>