Skip to content
Snippets Groups Projects
Commit dd32241a authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Nachbereitung 31.10.2019

parent 18dddc85
Branches
No related tags found
No related merge requests found
No preview for this file type
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
% Attribution-ShareAlike 3.0 Unported License along with this % Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>. % document. If not, see <http://creativecommons.org/licenses/>.
% README: Einführung in C: Arrays und Strings und Zeichen, Strukturen % README: Einführung in C: Arrays und Strings und Zeichen, Strukturen, Dateien und Fehlerbehandlung
\documentclass[10pt,t]{beamer} \documentclass[10pt,t]{beamer}
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
\color{red} \color{red}
\item[2.12] Strukturen \item[2.12] Strukturen
\item[2.13] Dateien und Fehlerbehandlung \item[2.13] Dateien und Fehlerbehandlung
\color{black}
\item[2.14] Parameter des Hauptprogramms \item[2.14] Parameter des Hauptprogramms
\item[2.15] String-Operationen \item[2.15] String-Operationen
\end{itemize} \end{itemize}
...@@ -604,43 +605,6 @@ ...@@ -604,43 +605,6 @@
\end{frame} \end{frame}
\nosectionnonumber{\inserttitle}
\begin{frame}
\shownosectionnonumber
\begin{itemize}
\item[\textbf{1}] \textbf{Einführung}
\hfill\makebox(0,0)[br]{\raisebox{2.25ex}{\url{https://gitlab.cvh-server.de/pgerwinski/hp}}}
\item[\textbf{2}] \textbf{Einführung in C}
\begin{itemize}
\vspace*{-\smallskipamount}
\item[\dots]
\item[2.5] Verzweigungen
\item[2.6] Schleifen
\item[2.7] Strukturierte Programmierung
\item[2.8] Seiteneffekte
\item[2.9] Funktionen
\item[2.10] Zeiger
\color{medgreen}
\item[2.11] Arrays und Strings
\item[2.12] Strukturen
\color{red}
\item[2.13] Dateien und Fehlerbehandlung
\item[2.14] Parameter des Hauptprogramms
\item[2.15] String-Operationen
\end{itemize}
\item[\textbf{3}] \textbf{Bibliotheken}
\vspace*{-\smallskipamount}
\item[\textbf{\dots}]
% \item[\textbf{4}] \textbf{Hardwarenahe Programmierung}
% \item[\textbf{5}] \textbf{Algorithmen}
% \item[\textbf{6}] \textbf{Ergänzungen und Ausblicke}
\end{itemize}
\end{frame}
\subsection{Dateien und Fehlerbehandlung} \subsection{Dateien und Fehlerbehandlung}
\begin{frame}[fragile] \begin{frame}[fragile]
...@@ -729,7 +693,7 @@ ...@@ -729,7 +693,7 @@
{ {
FILE *f = fopen ("fhello.txt", "w"); FILE *f = fopen ("fhello.txt", "w");
if (!f) if (!f)
error (-1, errno, "cannot open file"); error (1, errno, "cannot open file");
fprintf (f, "Hello, world!\n"); fprintf (f, "Hello, world!\n");
fclose (f); fclose (f);
return 0; return 0;
...@@ -774,158 +738,41 @@ ...@@ -774,158 +738,41 @@
\end{minipage} \end{minipage}
\end{frame} \end{frame}
\subsection{Parameter des Hauptprogramms} \nosectionnonumber{\inserttitle}
\begin{frame}[fragile]
\showsubsection
\begin{lstlisting}
#include <stdio.h>
int main (int argc, char **argv)
{
printf ("argc = %d\n", argc);
for (int i = 0; i < argc; i++)
printf ("argv[%d] = \"%s\"\n", i, argv[i]);
return 0;
}
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\showsubsection
\begin{lstlisting}
#include <stdio.h>
int main (int argc, char **argv)
{
printf ("argc = %d\n", argc);
for (int i = 0; *argv; i++, argv++)
printf ("argv[%d] = \"%s\"\n", i, *argv);
return 0;
}
\end{lstlisting}
\end{frame}
\subsection{String-Operationen}
\begin{frame}[fragile]
\showsubsection
\begin{lstlisting}
#include <stdio.h>
#include <string.h>
int main (void)
{
char hello[] = "Hello, world!\n";
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
printf ("%s\n", hello + 7);
printf ("%zd\n", strlen (hello + 7));
hello[5] = 0;
printf ("%s\n", hello);
printf ("%zd\n", strlen (hello));
return 0;
}
\end{lstlisting}
\vspace*{-1cm}
\end{frame}
\begin{frame}[fragile]
\showsubsection
\begin{lstlisting}
#include <stdio.h>
#include <string.h>
int main (void)
{
char *anton = "Anton";
char *zacharias = "Zacharias";
printf ("%d\n", strcmp (anton, zacharias));
printf ("%d\n", strcmp (zacharias, anton));
printf ("%d\n", strcmp (anton, anton));
char buffer[100] = "Huber ";
strcat (buffer, anton);
printf ("%s\n", buffer);
return 0;
}
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\showsubsection
\begin{lstlisting}
#include <stdio.h>
#include <string.h>
int main (void)
{
char buffer[100] = "";
sprintf (buffer, "Die Antwort lautet: %d", 42);
printf ("%s\n", buffer);
char *answer = strstr (buffer, "Antwort");
printf ("%s\n", answer);
printf ("found at: %zd\n", answer - buffer);
return 0;
}
\end{lstlisting}
\end{frame}
\begin{frame} \begin{frame}
\showsection \shownosectionnonumber
Sprachelemente weitgehend komplett
\bigskip
Es fehlen:
\begin{itemize} \begin{itemize}
\item \item[\textbf{1}] \textbf{Einführung}
Ergänzungen (z.\,B.\ ternärer Operator, \lstinline{union}, \lstinline{unsigned}, \lstinline{volatile}) \hfill\makebox(0,0)[br]{\raisebox{2.25ex}{\url{https://gitlab.cvh-server.de/pgerwinski/hp}}}
\item \item[\textbf{2}] \textbf{Einführung in C}
Bibliotheksfunktionen (z.\,B.\ \lstinline{malloc()}) \begin{itemize}
\arrowitem \vspace*{-\smallskipamount}
werden eingeführt, wenn wir sie brauchen \item[\dots]
\bigskip \item[2.5] Verzweigungen
\item \item[2.6] Schleifen
Konzepte (z.\,B.\ rekursive Datenstrukturen, Klassen selbst bauen) \item[2.7] Strukturierte Programmierung
\arrowitem \item[2.8] Seiteneffekte
werden eingeführt, wenn wir sie brauchen, oder: \item[2.9] Funktionen
\arrowitem \item[2.10] Zeiger
Literatur\\[\smallskipamount] \color{medgreen}
(z.\,B.\ Wikibooks: C-Programmierung,\\ \item[2.11] Arrays und Strings
Dokumentation zu Compiler und Bibliotheken) \item[2.12] Strukturen
\bigskip \item[2.13] Dateien und Fehlerbehandlung
\item \color{red}
Praxiserfahrung \item[2.14] Parameter des Hauptprogramms
\arrowitem \item[2.15] String-Operationen
Übung und Praktikum: nur Einstieg \end{itemize}
\arrowitem \item[\textbf{3}] \textbf{Bibliotheken}
selbständig arbeiten \vspace*{-\smallskipamount}
\item[\textbf{\dots}]
% \item[\textbf{4}] \textbf{Hardwarenahe Programmierung}
% \item[\textbf{5}] \textbf{Algorithmen}
% \item[\textbf{6}] \textbf{Ergänzungen und Ausblicke}
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\end{document} \end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment