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}]//ToCCodeString

Parentheses are added as necessary.

COperator[Times, {a,COperator[Plus, {a,b}]}]//ToCCodeString

Note that you can force the addition of extra parentheses using (PackageLink[CParentheses, paclet:SymbolicC/ref/CParentheses, SymbolicC Package Symbol]).

COperator[Times, {CParentheses[a],COperator[Plus, {a,b}]}]//ToCCodeString

Assignment

First, you need to load the package.

Needs["SymbolicC`"]

This shows the special representation for the assignment.

CAssign[a,b]//ToCCodeString

You can also give an operator to use for the assignment.

CAssign[AddTo,a,b]//ToCCodeString