3
$\begingroup$

This question already has an answer here:

What is they shortest way to automatically indent SymbolicC at the Brackets { and }?

For example:

CProgram[
  CInclude["stdlib.h"],
  CInclude["constants.h"],
  CFunction["int", "value", {}, CBlock[{CReturn["valueDefine"]}]]
  ] // ToCCodeString

should give

#include "stdlib.h"
#include "constants.h"

int value()
{
    return valueDefine;
}
$\endgroup$

marked as duplicate by Szabolcs, Leonid Shifrin, William, Mr.Wizard Feb 2 '15 at 2:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ Voted to close. $\endgroup$ – William Feb 2 '15 at 2:21
3
$\begingroup$

Yes, it's possible. Use

ToCCodeString[..., "Indent" -> 1]

I found this by checking Options[ToCCodeString]. The "Indent" option appears to control the number of tabs that will be used for indenting.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.