c - Typedef of structs -
i using structs in project in way:
typedef struct { int str1_val1; int str1_val2; } struct1;
and
typedef struct { int str2_val1; int str2_val2; struct1* str2_val3; } struct2;
is possible hack definition in way, use types code, like
struct2* a; = (struct2*) malloc(sizeof(struct2));
without using keyword struct
?
yes, follows:
struct _struct1 { ... }; typedef struct _struct1 struct1; struct _struct2 { ... }; typedef struct _struct2 struct2; ... struct2 *a; = (struct2*)malloc(sizeof(struct2));
Comments
Post a Comment