Possible Duplicate:
finding size of int array
I am curious why I get the following behaviour in this simple C++ code.
In this I try to calculate the size of a float array in 2 different places:
#include <iostream>
#include <iomanip>
using namespace std; 
void foo(float a[])
{
 int size = sizeof(a) / sizeof(float) ;
 cout << size <<std::endl;   
}
int main(int argc, char *argv[])
{
  float a[] = {22.2, 44.4, 66.6} ;
  int size = sizeof(a) / sizeof(float) ;
  cout << size <<std::endl;   
  foo(a);
  return 0;
}
Using the gcc compiler I get the output as 
~: ./a.out
3
2
~: 
With other array sizes I get the first entry to be the correct size but the second always to be 2,
Now in my codes I never pass arrays without their sizes if I use arrays and I usually use the std:: vectors. But I am curious what is happening here.
What information has the 'a' lost while being passed to the function?
What is the second sizeof(a) calculating ?
 
     
     
    