Here is my Mathematica code:
f[x_] := x^2 + 4 x + 4; Solve[f[x] == 9, x]
I tried to convert it to C but failed.
Here is the code for conversion:
CForm[f[x_] := x^2 + 4 x + 4]
and this
CForm[f[x_] := x^2 + 4 x + 4; Solve[f[x] == 9, x]]
The former one just outputs Null, the latter one just converts the final result in the below
List(List(Rule(x,-5)),
List(Rule(x,1)))
Standard arithmetic functions and certain control structures are translated.andNo declarations are generated.. SoCFormis limited to basic expressions that have direct C mapping. Also, What would CForm translateSolvecommand to in C? Since C do not have build in Solve command. If you doCForm[x^2 + 4 x + 4]then it translate it. – Nasser Dec 25 '19 at 02:40