First off, thanks for everyone who's helped me so far. I know I've been asking a lot of questions.
How do you malloc a struct in C? I have a structure of the form:
Code:
typedef struct child_req_to_parent
{
req_type type;
child_request req;
}child_req_to_parent;
I basically want to allocate the space using malloc so that I can use free at a later time multiple times. I've been trying to implement it by
Code:
struct child_req_to_parent Router_Buf;
Router_Buf = (Router_Buf*)malloc(sizeof(Router_Buf));
But this is clearly wrong. If someone could help me with using malloc on such a struct it would be great. Thanks!