W
Wayne Shu
Hi everyone.
In the following program, foo is an ambiguous call.
#include <iostream>
using namespace std;
void foo(int *);
void foo(int (&)[5]);
int main()
{
int arr[5] = {0, 1, 2, 3, 4};
foo(arr);
return 0;
}
why?
void foo(int (&)[5]); is an exact match
void foo(int (&)[5]); require an array to pointer conversion.
Regards.
In the following program, foo is an ambiguous call.
#include <iostream>
using namespace std;
void foo(int *);
void foo(int (&)[5]);
int main()
{
int arr[5] = {0, 1, 2, 3, 4};
foo(arr);
return 0;
}
why?
void foo(int (&)[5]); is an exact match
void foo(int (&)[5]); require an array to pointer conversion.
Regards.