How to stringify an expression in C

前端 未结 7 1351
刺人心
刺人心 2020-12-07 01:53

Is there a way to evaluate an expression before stringification in c?

example:

#define stringify(x)  #x
...
const char * thestring = stringify( 10 *          


        
7条回答
  •  萌比男神i
    2020-12-07 02:10

    You need to interpret the string. C doesn't do that by itself, look up a library that'll do it for you.

    http://expreval.sourceforge.net/ http://www.codeproject.com/KB/library/expreval.aspx

    There are others, just search google.

提交回复
热议问题