# SymbolicC: Is there a CChar, i.e. a way to generate a single character constant?

I am aware of CConstant and CString, but neither can output the single-char literal

'a'


You could do

CArray[CString@"a", 0] // ToCCodeString


giving

"a"[0]


maybe wrap it in CParentheses.

Alternatively, just put it there verbatim (losing the type information):

CAssign[a, "'a'"] // ToCCodeString


gives

a = 'a'

• Just put it there verbatim, there is really no need for the complication with CArray`. Generally, bits of C code can be written in a string. You only need symbolic representation when you want to manipulate it as an expression. – Szabolcs Feb 12 '17 at 20:02