+ 1
error in structure printing
structure required on left side l or .* what does it means
1 Answer
+ 2
if you make a struct mstruct. then make objects of mstruct type, obj1, obj2. you cannot simply say
cout << obj1;
you need to do 1 of 2 things.
create a print function for mstruct and call it
obj1.print();
or
overload the << operator to print it out.
ostream operator << (ostream & os,
const mstruct & obj){
os << obj.val;
return os;
}
cout << obj1;
hope this helps