title: why is 'Hello' being printed out when it is compared with 'World' in cpp?
body: <p><em>I was trying templates in CPP. I could not understand why 'Hello' is being printed when I compare it with 'World'?</em> </p>
  
  <p><strong>Below is my code snippet -></strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  using std::cout;
  using std::endl;
  
  template &lt;typename T&gt;
  T max(T a, T b){
  if(a &gt; b){
  return a;
  }
  else{return b;}
  }
  
  int main() {
    cout &lt;&lt; "max(3, 5): " &lt;&lt; max(3, 5) &lt;&lt; endl;
    cout &lt;&lt; "max('a', 'd'): " &lt;&lt; max('a', 'd') &lt;&lt; endl;
    cout &lt;&lt; "max(\"Hello\", \"World\"): " &lt;&lt; max("Hello", "World") &lt;&lt; endl;
    return 0;
  }
  </code></pre>
  
  <p><strong>Output</strong></p>
  
  <pre><code>ec2-user:~/environment/cpp_learn/uiuc_cpp/cpp-templates (master) $ make
  g++ -std=c++14 -O0 -pedantic -Wall  -Wfatal-errors -Wextra  -MMD -MP -g -c  main.cpp -o .objs/main.o
  g++ .objs/main.o -std=c++14  -o main
  ec2-user:~/environment/cpp_learn/uiuc_cpp/cpp-templates (master) $ ./main 
  max(3, 5): 5
  max('a', 'd'): d
  max("Hello", "World"): Hello
  </code></pre>
  
  <p>Here is the C++ version that I use -> </p>
  
  <pre><code>ec2-user:~/environment/cpp_learn/uiuc_cpp/cpp-templates (master) $ c++ --version
  c++ (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
  Copyright (C) 2017 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  </code></pre>
  
  <p>Thanks in advance for your help. I apologize if the answer is too obvious. </p>