while (in >> p[i])
{
i++;
}
this is where im having trouble. i know that p is an array that hold the pointer to the DATA but i dont know the syntax to actually access it.
int main () {
int var;
int *ptr;
int **pptr;
var = 3000;
// take the address of var
ptr = &var;
// take the address of ptr using address of operator &
pptr = &ptr;
// take the value using pptr
cout << "Value of var :" << var << endl;
cout << "Value available at *ptr :" << *ptr << endl;
cout << "Value available at **pptr :" << **pptr << endl;
return 0;
}
This example shows that it doesnt matter if i use the pointer to DATA to access my DATA.
In your original code (line 66) you create an array of pointer to DATA. You never create the DATA objects. On line 57 you try to read the data of the stream into the pointer not the DATA.
This example shows that it doesnt matter if i use the pointer to DATA to access my DATA.
Yes, if you do that right (but you doesn't in your original code). However, it doesn't make sense to add another level of indirection which is error prone.