title: problem with sizeof operator
body: <p>As i want to find array size dynamically in function, i used sizeof operator. But i got some unexpected result.
  here is one demo program to show you, what i want to do.</p>
  
  <pre><code>//------------------------------------------------------------------------------------------
  #include &lt;iostream&gt;
  
  void getSize(int *S1){
  
      int S_size = sizeof S1/sizeof(int);
      std::cout&lt;&lt;"array size(in function):"&lt;&lt;S_size&lt;&lt;std::endl;
  }
  
  int main(){
  
      int S[]={1,2,3,2,5,6,25,1,6,21,121,36,1,31,1,31,1,661,6};
      getSize(S);
      std::cout&lt;&lt;"array size:"&lt;&lt;sizeof S/sizeof(int)&lt;&lt;std::endl;
      return 0;
  }
  //------------------------------------------------------------------------------------------
  </code></pre>
  
  <p>compilation command : g++ demo1.cc -o demo1 {fedora 12}</p>
  
  <p>output:</p>
  
  <pre><code>array size(in function):2
  array size:19
  </code></pre>
  
  <hr>
  
  <p>please explain ,why this is happening.
  what can be done to solve this problem.</p>