I had come across the following code:
typedef struct {
double x;
double y;
double z;
} *vector;
Is this a valid type definition? The code compiles and runs fine. I was just curious if this is common practice.
Absolutely valid. Usually, you can take full advantage of this way by defining two types together:
typedef struct
{
int a;
int b;
} S1, *S1PTR;
Where S1 is a struct and S1PTR is the pointer to this struct.