I am writing a struct _Point3d
and typedefed it to Point3d
and provided a pointer declaration PPoint3d
next to Point3d
(Please see code). There is a constructor which initializes members of the struct
. I have twofold queries here.
typedef struct _Point3d
{
float x;
float y;
float z;
_Point3d(float _x, float _y, float _z) : x(_x), y(_y), z(_z)
{
}
}Point3d, *PPoint3d;
One:
What does this convention of providing pointer after struct name (typedef) really means? provided we can create the pointer of Point3d
like this
Point3d* _ppoint2 = new Point3d(1.0, 0.0, 0.0);
Two:
Is there any difference in creating instances of Point3d
in these two different ways.
PPoint3d _ppoint1 = new Point3d(0.0, 1.0, 0.0);
Point3d* _ppoint2 = new Point3d(1.0, 0.0, 0.0);