Home
  Contact
  Short Vita
  Research
  Teaching
  LSDIS Lab
  Links

 

Hints about using yytext as an external variable

When using an external declaration of the yytext variable (to access it in a different C/C++ file), declare it as:

extern char yytext[]; when using lex
extern char *yytext; when using flex

This is because lex declares yytext as an array of characters, while flex declares it (by default) as a character pointer.