title: Why doesn't `sizeof()` work as expected when the argument is a dereferenced pointer pointing to an array?
body: <p>My problem is when using <code>sizeof()</code>, the result is the pointer size not the array pointed to.</p>
  
  <p>Please, help me.</p>
  
  <p>Here is the code.</p>
  
  <p>The first function creates a 2d matrix and the second displays it while the main function performs a test.</p>
  
  <pre><code> #include&lt;iostream&gt;
   template&lt;typename T&gt;
      T** Mat(T vals[],size_t m, size_t n){
  
          T** mat=new T*[m];
  
          for(size_t i=0;i&lt;m;i++) mat[i]=new T[n];
  
          for(size_t mi=0;mi&lt;m;mi++){
  
              for(size_t ni=0;ni&lt;n;ni++){
                  mat[mi][ni]=vals[mi*(n-1)+ni];
  
              }
          }
          return mat;
      }
  
  
  template&lt;typename T&gt;
  void dispMat2d(T** mat){
  
      for(size_t mi{};mi&lt;sizeof(*mat)/sizeof(mat[0]);mi++){
  
          std::cout&lt;&lt;"I'm here "&lt;&lt;sizeof(*mat)/*/sizeof(mat[0])*/&lt;&lt;"\n";
  
              for(size_t ni{};ni&lt;sizeof(*mat[0])/sizeof(mat[0][0]);ni++){
                  std::cout&lt;&lt;"o"&lt;&lt;mat[mi][ni]&lt;&lt;"\t";
  
              }
              std::cout&lt;&lt;std::endl;
      }
  }
  int main(int c, char* arr[]){
  
      double v[]={1.0,2,3,4,5,6};
  
      auto myMat=Mat&lt;double&gt;(v,2,3);
  
  
      dispMat2d(myMat);
  
      return 0;
  }
  </code></pre>
  
  <p>I tried to use <code>std::size()</code> but it doesn't accept the arguments <code>*myMat1</code> and <code>**myMat1</code>.
  Thanks in advance</p>