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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Absolutely valid.
Usually, you can take full advantage of this way by defining two types together:
Where S1 is a struct and S1PTR is the pointer to this struct.