I've been given this code for a struct:
struct Part /*A Part record*/
{
int ID;
float Price;
int Quantity;
};
typedef Part *Partptr;
// Part record pointer type; The type Partptr becomes synonymous with Part *
typedef Partptr* Index;
// The type Index becomes synonymous with Partptr *
I'm confused on what the typedefs below it are doing. Later in the program, I'm trying to define a dynamically allocated array of this struct using the provided variable Index DBindex, but when I try doing so like this:
DBindex = new Index[];
I get an error:
a value of type "Index *" cannot be assigned to an entity of type "Index"
I thought Index was a pointer, based on the typedef. What am I missing here?