C Operators
C Operators
SymbolicC supports the various types of C operators. These are described in this section.
Infix Operators
First, you need to load the package.
Needs["SymbolicC`"]The following shows how to output to get infix multiplication.
COperator[Times, {a, b}]//ToCCodeStringParentheses are added as necessary.
COperator[Times, {a, COperator[Plus, {a, b}]}]//ToCCodeStringNote that you can force the addition of extra parentheses using CParentheses.
COperator[Times, {CParentheses[a], COperator[Plus, {a, b}]}]//ToCCodeStringAssignment
First, you need to load the package.
Needs["SymbolicC`"]This shows the special representation for the assignment.
CAssign[a, b]//ToCCodeStringYou can also give an operator to use for the assignment.
CAssign[AddTo, a, b]//ToCCodeString