C.tex 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. \chapter{C}
  2. \index{C|(}
  3. C ist eine imperative Programmiersprache. Sie wurde in vielen Standards
  4. definiert. Die wichtigsten davon sind:\todo{Wo sind unterschiede?}
  5. \begin{itemize}
  6. \item C89
  7. \item C99
  8. \item ANSI C
  9. \item C11
  10. \end{itemize}
  11. \section{Datentypen}\xindex{Datentypen}
  12. Die grundlegenden C-Datentypen sind
  13. \begin{table}[htp]
  14. \centering
  15. \begin{tabular}{|l|l|}
  16. \hline
  17. \textbf{Typ} & \textbf{Größe} \\ \hline\hline
  18. char & 1 Byte \\ \hline
  19. int & 4 Bytes \\ \hline
  20. float & 4 Bytes \\ \hline
  21. double & 8 Bytes \\ \hline
  22. void & 0 Bytes \\ \hline
  23. \end{tabular}
  24. \end{table}
  25. zusätzlich kann man \texttt{char}\xindex{char} und \texttt{int}\xindex{int}
  26. noch in \texttt{signed}\xindex{signed} und \texttt{unsigned}\xindex{unsigned}
  27. unterscheiden.
  28. \section{ASCII-Tabelle}
  29. \begin{table}[htp]
  30. \centering
  31. \begin{tabular}{|l|l||l|l||l|l||l|l|}
  32. \hline
  33. \textbf{Dez.} & \textbf{Zeichen} & \textbf{Dez.} & \textbf{Zeichen} & \textbf{Dez.} & \textbf{Zeichen} & \textbf{Dez.} & \textbf{Zeichen} \\ \hline\hline
  34. 0 & ~ & 31 & ~ & 64 & @ & 96 & ' \\ \hline
  35. 1 & ~ & ~ & ~ & 65 & A & 97 & a \\ \hline
  36. 2 & ~ & ~ & ~ & 66 & B & 98 & b \\ \hline
  37. 3 & ~ & ~ & ~ & ~ & C & 99 & c \\ \hline
  38. 4 & ~ & ~ & ~ & ~ & D & 100 & d \\ \hline
  39. 5 & ~ & ~ & ~ & ~ & E & ~ & ~ \\ \hline
  40. 6 & ~ & ~ & ~ & ~ & F & ~ & ~ \\ \hline
  41. 7 & ~ & ~ & ~ & ~ & G & ~ & ~ \\ \hline
  42. 8 & ~ & ~ & ~ & ~ & H & ~ & ~ \\ \hline
  43. 9 & ~ & ~ & ~ & ~ & I & ~ & ~ \\ \hline
  44. 10 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  45. 11 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  46. 12 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  47. 13 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  48. 14 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  49. 15 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  50. 16 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  51. 17 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  52. 18 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  53. 19 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  54. 20 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  55. 21 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  56. 22 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  57. 23 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  58. 24 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  59. 25 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  60. 26 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  61. 27 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  62. 28 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  63. 29 & ~ & ~ & ~ & ~ & ~ & ~ & ~ \\ \hline
  64. 31 & ~ & ~ & ~ & ~ & ~ & 127 & ~ \\ \hline\hline
  65. \end{tabular}
  66. \end{table}
  67. \section{Syntax}
  68. \section{Beispiele}
  69. \subsection{Hello World}
  70. Speichere den folgenden Text als \texttt{hello-world.c}:
  71. \inputminted[linenos, numbersep=5pt, tabsize=4, frame=lines, label=hello-world.c]{c}{scripts/c/hello-world.c}
  72. Compiliere ihn mit \texttt{gcc hello-world.c}. Es wird eine ausführbare
  73. Datei namens \texttt{a.out} erzeugt.
  74. \index{C|)}