I get the size of the integer array by using sizeof operator but the problem is:
+ Outside class: It outputs 3 (correct)
+ Inside class: It outputs 1 (incorrect)
So how to fix it?
Thanks
class A
{
public:
A(const int a[]);
};
A::A(const int a[])
{
cout << "Inside class definition ";
cout << sizeof(a) / sizeof(int) << endl;
}
int main()
{
int a[] = {1, 3, 2};
A obj(a);
cout << "Outside class definition ";
cout << sizeof(a) / sizeof(int) << endl;
return 0;
}