title: pass reference to array in C++
body: <p>Can any one help me understand the following code</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  void foo(const char * c)
  {
     std::cout &lt;&lt; "const char *" &lt;&lt; std::endl;
  }
  
  template &lt;size_t N&gt;
  void foo(const char (&amp;t) [N])
  {
     std::cout &lt;&lt; "array ref" &lt;&lt; std::endl;
     std::cout &lt;&lt; sizeof(t) &lt;&lt; std::endl;
  }
  
  int main()
  {
      const char t[34] = {'1'};
      foo(t);
  
      char d[34] = {'1'};
      foo(d);
  }
  </code></pre>
  
  <p>The output is </p>
  
  <pre><code>const char *
  array ref
  34
  </code></pre>
  
  <p>Why does the first foo calls the <code>const char *</code> version ? How can I make it call the reference version ?</p>