title: What is the role of BOOL in the given code?
body: <p>Here's a c++ code to sort the data of various types using template function. Can someone elaborate what does BOOL do here?
  I've read about bool data type. It basically assumes only two values TRUE and FAlSE. But I've no idea, what is the role of BOOL here ?</p>
  <pre><code>   using namespace std;
      #include &lt;iostream&gt;
      
        template &lt;class T&gt;
        void sort (T array[], int size)
        { int j;
          T temp;
          int pass;
          static int call = 0;
          bool xchange = true;
          for (pass = 1; pass &lt; size &amp;&amp; xchange == true; pass++)
          { xchange = false;
            for (j=0; j &lt; size - pass; j++)
            { if (array[j] &gt; array[j+1])
              { temp = array[j]; array[j] = array[j+1]; array[j+1] = temp;
                xchange = true;
              } /* end of if */
            } /* end of inner for loop */
          };
          call ++;
          cout &lt;&lt; &quot; within sort : value of call is &quot; &lt;&lt; call &lt;&lt; endl;
          /* end of outer for loop */
         } /* end of bubble sort */
      
        int main() {
         int a[] = {1,5,6,4,0,8,5,7,9,2};
         int a1[] = {1,5,6,4,0,8,5,7,9,2};
         char b[] = { 'a', 'c', 'f', 'd', 'b' };
        
         sort (a, 10);
         for ( int i=0; i &lt; 10; i++ ) cout &lt;&lt; a[i] &lt;&lt; &quot;  &quot;;
         cout &lt;&lt; endl;
         sort (b, 5);
         for ( int i=0; i &lt; 5; i++ ) cout &lt;&lt; b[i] &lt;&lt; &quot;  &quot;;
         cout &lt;&lt; endl;
         sort (a1, 10);
         for ( int i=0; i &lt; 10; i++ ) cout &lt;&lt; a1[i] &lt;&lt; &quot;  &quot;;
         cout &lt;&lt; endl;
         
         return 0;
        }
  </code></pre>