I have something like:
typedef struct Data DATA, *DATA_PTR;
typedef struct Units UNITS, *UNITS_PTR;
struct Data
{
double miscData;
UNITS units;
};
struct Units
{
double x[2];
double y[2];
double z[2];
};
in my project_typedef.hfile.
In another file, I have something like:
void fileInput(DATA_PTR data)
{
data->miscData = 0;
data->units.x[0] = 5;
}
However, this does not work, as units are declared after the data in project_typedef.h(if I switch the order in which it works). The error I get “to the left of .x 'should be of type struct / union.” I thought that the following declaration would be accepted in this declaration. Why not?
source
share