C (.c)

Background & Context

    • C programming language.
    • General-purpose implementation language for computer systems and applications.
    • Developed at Bell Telephone Laboratories in 1972.


  • Export["file.c",{expr1,expr2,}] exports a list of compiled functions to one set of code and header files.
  • Export["file.c",ss] exports a discrete-time state-space model ss.
  • Export["file.c",CompiledFunction[]] exports a CompiledFunction object to C language code and header files.
  • Export["file.c",StateSpaceModel[]] exports a discrete-time StateSpaceModel object.
  • Export uses the string "file" in Export["file.c",CompiledFunction[]] as the C function name.
  • The exported source and header files have the same file name base.
  • Export["file.c","fn"->expr] exports expr using "fn" as the C function name.
  • Export["file.c",{"fn1"->expr1,"fn2"->expr2,}] exports multiple CompiledFunction objects to one set of code and header files.
  • Export["file.c",expr,elem] creates code and header files by treating expr as specifying element elem.
  • Export["file.c",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
  • Export["file.c",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.c",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the following reference pages for full general information:
  • Exportexport to a file
    CloudExportexport to a cloud object
    ExportStringexport to a string
    ExportByteArrayexport to a byte array


  • Export option:
  • "CreateHeaders"Truewhether to generate header file


Basic Examples  (4)

Generate C files for a mathematical function:

Export multiple CompiledFunction objects to a C source and header files:

Export a StateSpaceModel object to C source and header files:

Create source and header files with given function names: