need some guide here
I got a code which is
struct Point
{
int x;
int y;
};
then at my class i got a function
class MyClass
{
private:
Point myPoint[4];
public:
void setPoint();
};
void MyClass::setPoint()
{
int xData,yData;
for (int i=0;i<4;i++)
{
cout << "Please enter x-ordinate:";
cin >> xData;
cout << "Please enter y-ordinate:";
cin >> yData;
//at this part the code throw a segmentation core dump.
myPoint[i].x = xData;
myPoint[i].y = yData;
}
}
On first run nothing happen, but on 2nd loop, segmentation core dump occur. whats wrong with my code?
Additional code on main.cpp
#include "MyClass.h"
int main()
{
MyClass *mClass;
mclass->setPoint();
}
Thanks for helping.