Hi
I want to create an array as shown in the class below
everything is working fine, but at the end of execution of the program, there is a memory fault
Please help me in finding out the problem
class a
{
int i;
int arr[];
public:
a();
~a();
void disp();
};
a::a():i(10)
{
int j = 0;
for(; j < i; j++)
{
arr[j] = j;
cout<<"In constructor j value is "<<j<<endl;
}
}
a::~a()
{
}
void a::disp()
{
for(int j=0; j < i; j++)
{
cout<<arr[j]<<"\t";
}
cout<<endl;
}
int main() {
a obj;
obj.disp();
return 0;
}
Thanks
VADAN