Is there any way we can form and execute a statement at runtime in C?
Is there any way we can form and execute a statement at runtime in C?
Well, yes and no. You can't form a C expression and run it, but you could generate code at runtime - there is also no standard way of doing that, it changes both with processor architecture and OS architecture how you go about this.
What are you actually trying to do? As in, do you have a particular problem you are trying to solve, and if so, can you explain what the problem is?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
There are three integer variables x1, x2 and x3 having values 1,2 and 3 respectively. Another fourth array variable x contains either x1, x2 or x3. I want to print the value of the variable which is the value of x. e.g. if x contains x2, I want to display 2. (Of course this is a simplification of a bigger program).
Sounds like all you need is a pointer to the right variable [somehow you must know which variable you want printed somewhere, right?]
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Yes.
So I take it that solved the problem?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.