class linklist4x4
{
private:
struct node4x4
{
double data[4][4];
node4x4 *link;
}*p;
public:
linklist4x4();
void append( double* num );
void add_as_first( double* num );
void addafter( int c, double* num );
//void del( double* num );
void display();
int count();
double* getdata(int c);
~linklist4x4();
};
The above is my class declaration.
Now below is a function declaration.
void linklist4x4::append(double* num)
{
node4x4 *q,*t;
if( p == NULL )
{
p = new node4x4;
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
p->data[i][j]=num[i][j];//error line
p->link = NULL;
}
else
{
q = p;
while( q->link != NULL )
q = q->link;
t = new node4x4;
for(int i=0;i<4;i++)
for(int j=0;j<4;j++)
t->data[i][j]=num[i][j];//error line
t->link = NULL;
q->link = t;
}
}
When i try to compile, it gives me an error saying that "error C2109: subscript requires array or pointer type" at the marked commented lines as shown.
Can anyone please help?