#include #include ... struct ltstr { bool operator()(const char *s1, const char *s2) const { return strcmp(s1, s2) < 0; } }; ... using namespace std; map value; // variables // the symbol table implements a // function (map) from char * to char * ... enum Bool {NO=0, YES=1}; static inline Bool is_defined(char *name) { // YES if name is in the symbol table return ((value.find(name) == value.end()) ? NO : YES); } ... char *v = value["X"]; // set v to point to the value of X value["X"] = ""; // set the value of the var X to "" << Comments >> o If you map from char * to char *, the pointers should not point to memory that will disappear (e.g., variables on the stack). BAD: void foo (...) { char buf[100]; ... some code that puts a string into buf[] ... value["Some_Name"] = buf; // buf[] will disappear upon } // return from foo BETTER: void foo (...) { char buf[100]; ... some code that puts a string into buf[] ... value["Some_Name"] = strdup(buf); } // strdup() allocates from heap; need to free space later o Mapping from char * to char * is OK, but C++ string to C++ string might be better for real C++ programmers.