typedef struct mytruct // struct definition
{
int example;
};
void foo()
{
mystruct ms = NULL; // variable definition
ms = malloc(sizeof(mystruct)); // allocate memory.
memset(ms,0,sizeof(mystruct)); // initialize memory.
ms->example = 1337; // use the struct
free(ms); // free the memory allocated
ms = NULL; // signalize the pointer has become invalid.
}