using information from an array
i have a scanf that puts an equation such as: x*x+x-2 into an array. what i want to do with the array is thus... use the equation to calculate something somehow. i am unable to say blah = array because it is trying to assign the array to blah. how can i utilize the information inserted into the array as an equation rather than simply information in the array? please at least reply letting me know if i have not provided enough information. thank you.
Java Script eval() Equivalent Needed
I take it that you have the formula held in a string and wish to excute it as a program instruction? Certainly you can do this in Java Script ( which is a a sort of C derived language ) using the eval function eg
str="x=5;y=7;x*y";
eval(str);
gives "35" etc. You can use it to pass programs around the net as strings and execute them. For instance, if you have an asp routine on a server you can pass variables or even lines of code to a Java Script program on the client machine. This can hugely speed up web sites by cutting out the long wait every time the client pushes a button ( because all the code is on his machine already )
Now for C and an awful confession! I only have three days C programming experience and it will take me at least three more days ( four if I have to understand pointers ) to become an expert.
So, does C have an equivalent function to eval??