[SPCA] Start C syntax summary

This commit is contained in:
2026-01-04 12:09:01 +01:00
parent 46083b9782
commit c7618f38a4
8 changed files with 350 additions and 7 deletions

View File

@@ -1,8 +1,13 @@
I can clearly C why you'd want to use C. Already sorry in advance for all the bad C jokes that are going to be part of this section
\texttt{C} is a compiled, low-level programming language, lacking many features modern high-level programming languages offer, like Object Oriented programming, true Functional Programming, Garbage Collection, complex abstract datatypes and vectors, just to name a few. (It is possible to replicate these, more on this later).
\texttt{C} is a compiled, low-level programming language, lacking many features modern high-level programming languages offer, like Object Oriented programming,
true Functional Programming (like Haskell implements), Garbage Collection, complex abstract datatypes and vectors, just to name a few.
(It is possible to replicate these using Preprocessor macros, more on this later).
On the other hand, it offers the ability to directly integrate assembly code into the \texttt{.c} files, as well as bit level data manipulation and extensive memory management options, again just to name a few.
On the other hand, it offers the ability to directly integrate assembly code into the \texttt{.c} files,
as well as bit level data manipulation and extensive memory management options, again just to name a few.
This of course leads to \texttt{C} performing excellently and there are many programming languages who's compiler doesn't directly produce machine code or assembly, but instead optimized \texttt{C} code that is then compiled into machine code using a \texttt{C} compiler.
This has a number of benefits, most notably that \texttt{C} compilers can produce very efficient assembly, as lots of effort is put into the \texttt{C} compilers by the hardware manufacturers.
This of course leads to \texttt{C} performing excellently and there are many programming languages who's compiler doesn't directly produce machine code or assembly,
but instead optimized \texttt{C} code that is then compiled into machine code using a \texttt{C} compiler.
This has a number of benefits, most notably that \texttt{C} compilers can produce very efficient assembly,
as lots of effort is put into the \texttt{C} compilers by the hardware manufacturers.

View File

@@ -0,0 +1,6 @@
\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/01_syntax/}{00_intro.c}
\inputcodewithfilename{c}{code-examples/00_c/01_syntax/}{01_func.h}
\inputcodewithfilename{c}{code-examples/00_c/01_syntax/}{01_func.c}