Given the following program,
#include
using namespace std;
void foo( char a[100] )
{
cout << \"foo() \" << sizeof( a ) <
Yes. In C and C++ you cannot pass arrays to functions. That's just the way it is.
Why are you doing plain arrays anyway? Have you looked at boost
/std::tr1::array
/std::array
or std::vector
?
Note that you can, however, pass a reference to an array of arbitrary length to a function template. Off the top of my head:
template< std::size_t N >
void f(char (&arr)[N])
{
std::cout << sizeof(arr) << '\n';
}