Returning a pointer to the globaltoken structure in your scanner()
* The scanner converts the lexeme to the correct
* type, inserts the value and the type into the
* global structure, then returns a pointer to the
* global structure (for coding convenience).
TokenType lex_token; /* global token structure */
extern TokenType *scanner();
extern TokenType lex_token; /* global token */
lex_token.type = T_STRING; /* return char* */
lex_token.value.string = mystring;
lex_token.type = T_IDENT; /* IDs are char* */
lex_token.value.string = mystring;
/* convert ASCII digits to a real integer */
status = convert_to_integer(lexbuf,&myint);
if( status != GOOD_INT ) do_error(. . .);
lex_token.type = T_INTEGER; /* return integer */
lex_token.value.integer = myint;