mirror of
https://github.com/janishutz/eth-summaries.git
synced 2026-01-11 19:48:27 +00:00
14 lines
1.1 KiB
TeX
14 lines
1.1 KiB
TeX
\subsection{The Syntax}
|
|
\texttt{C} uses a very similar syntax as many other programming languages, like \texttt{Java}, \texttt{JavaScript} and many more\dots
|
|
to be precise, it is \textit{them} that use the \texttt{C} syntax, not the other way around. So:
|
|
\inputcodewithfilename{c}{code-examples/00_c/}{00_intro.c}
|
|
|
|
In \texttt{C} we are referring to the implementation of a function as a \bi{(function) definition} (correspondingly, \textit{variable definition}, if the variable is initialized)
|
|
and to the definition of the function signature (or variables, without initializing them) as the \bi{(function) declaration} (or, correspondingly, \textit{variable declaration}).
|
|
|
|
\texttt{C} code is usuallt split into the source files, ending in \texttt{.c} (where the local functions and variables are declared, as well as all function definitions)
|
|
and the header files, ending in \texttt{.h}, where the external declarations are defined. Usually, no definition of functions are in the \texttt{.h} files
|
|
\inputcodewithfilename{c}{code-examples/00_c/}{01_func.h}
|
|
|
|
\inputcodewithfilename{c}{code-examples/00_c/}{01_func.c}
|