You can do
typedef struct {
token* tokens;
} template;
t.tokens = malloc(sizeof(token)*20);
token* tokens[20]
will give you an array of 20 pointers to tokens. This would useful when you want 20 lists of tokens.
But from your question I assume, that you only want one list ok tokens, so just use token* tokens
.
An alternative is:
typedef struct {
token tokens[20]; // now you don't need malloc at all!
} template;
In the first approach, the number of tokens can be dynamic and given at runtime. For the second version, the (maximum) number of tokens must be known at compile time.