Why would I want to do this?
typedef struct Frame_s
{
int x;
int y;
int z;
} Frame_t;
Also if I want to create an object what do I use Frame_s or Frame_t?
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.
You would use
Frame_t.With
typedefyou are saying thatFrame_tandstruct Frame_sare the exact same type.So these are equivalent sentences:
I would use:
And always declare my vars like this:
Confusion usually comes from places where you use that sentence in a C++ piece of code. If you use C++ with that
typedefyou can use either:But if you use a plain C compiler, then
//2is invalid.