#define datatype(type) typein the preprocessor section.
Then when the user inputs a data type I could do
scanf( "%s %s", type, value ); datetype(type) x = (datatype(type)) atoi(value);or something like that (in this case the program allows the user to choose an integer type, but I could allow more options as well).
The problem with this is that type is a string, whereas the input to the datatype macro is a program token. It would be necessary to input a string into the macro function, or convert it to a generic program token, if that's even possible.
So is there any way to do this?


Sign In
Create Account


Back to top









