Sorry for using Inception in the title but it's the only way I think I can describe it..
Take this for example:
Definition.H
struct XY
{
string info;
string name;
string tag;
string attrib;
}; //is it better to create an object here inorder to make the array?
struct JK
{
XY* Me;
friend ostream& operator << (ostream& Str, const JK &Meh)
{
for (int I = 0; I < sizeof(Meh)/sizeof(Meh[0]); I++)
{
Str<<" "<<Meh[I]<<" ";
}
return Str;
}
}
Struct JK creates an array of Struct XY.. Now when I try to print out the contents of the Array.. it returns 1 for the size every single time! Why? Is my math wrong? Am I doing something wrong? Why is sizeof(Meh)/sizeof(Meh[0]).. 1? I just want it to print all the contents of the array.
In my program I have:
JK P[10].. Shouldn't the size be 10? or the amount of elements?
In my program, I can access each element of the array and print them like:
cout<< *P[0]<<*P[1].. etc..
But I cannot do that in the above code in the Definition.H.