TITLE: overloading functions based on array lengths (Newsgroups: comp.std.c++, 21 Sep 98) STAFFORD: Robert Stafford > Are the two function declarations > > int f(char a[25]); > > and > > int f(char* a); > > distinct? OLIVA: Alexandre Oliva No, they are just duplicate declarations of the same function. STAFFORD: > That is, is the second a redeclaration of the first, or may we, > in essence, overload on array length? OLIVA: You can onverload on array length, but only if you pass the array by reference: int f(char (&a)[13]); (Private email) TRIBBLE: David R Tribble What about: int foo(char (*a)[10]); int foo(char (*b)[20]); Arguments 'a' and 'b' are distinct types (my compiler thinks so, too), so foo() can be overloaded on them. Note that 'a' and 'b' are both of type "pointer to array[N] of char", not "pointer to char".