-
Printing a special type?
Hey guys, I'm trying simply to print the property called "NodeKind" within my syntax tree. It's declared as such:
Code:
typedef enum {VarK,IdK,OpK,ConstK,ComK} NodeKind;
Every node in my tree has a "kind" pointer. But when I try to use the following print statement, nothing is printed:
Code:
printf("%s", ptree->kind);
Is there a special way to print out special types like this? Thanks to anyone for any help!
-
You have to make your own translation, e.g. use an array of strings and index with your enum type.
There is no way at runtime to tell what the different enum types are called - that information disappears when the compiler generates the code.
--
Mats