\documentclass[usenames,dvipsnames]{beamer} %---------------------------------------------------------------------------------------- % Struktur und Pointer Referat % 20.04.2020 %---------------------------------------------------------------------------------------- \usetheme{focus} % Use the Focus theme supplied with the template \usepackage[utf8]{inputenc} \usepackage{booktabs} \usepackage{amsmath} \usepackage{hyperref} \usepackage{graphicx} \usepackage{listings} % Required for better table rules \usepackage{xcolor} % Farbdefinitionen \definecolor{backgroundcoloreq}{RGB}{180,140,0} \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} \definecolor{codepurple}{rgb}{0.58,0,0.82} \definecolor{codeorange}{RGB}{190,100,0} \lstset{ language=C, basicstyle=\ttfamily, numbers=left, numberstyle=\tiny, tabsize=4, columns=fixed, showstringspaces=false, showtabs=false, breaklines=true, keepspaces, morekeywords={std}, keywordstyle=\color{blue}\ttfamily, stringstyle=\color{red}\ttfamily, commentstyle=\color{OliveGreen!85}\ttfamily, numberstyle=\tiny\color{codegray}, basicstyle=\footnotesize\selectfont\ttfamily, % keyword highlighting classoffset=1, % starting new class otherkeywords={>,<,.,;,-,+,!,=,~,:,[,],NULL,&}, morekeywords={>,<,.,;,-,+,!,=,~,:,[,],NULL,&}, keywordstyle=\color{codeorange}, classoffset=0 } %---------------------------------------------------------------------------------------- % TITLE SLIDE %---------------------------------------------------------------------------------------- \title{Strukturen + Pointer \\ Call by Reference/Value} \subtitle{mit Anwendungsfälle / Programmierbeispiele} \author{Lukas Heiligenbrunner} \institute{HTL Steyr \\ Schlüsselhofgasse 63} \date{\today} %------------------------------------------------ \begin{document} %------------------------------------------------ \begin{frame} \maketitle % Automatically created using the information in the commands above \end{frame} %---------------------------------------------------------------------------------------- % SECTION 1 %---------------------------------------------------------------------------------------- \section{Strukturen} % Section title slide, unnumbered %------------------------------------------------ \begin{frame}{Strukturen Allgemein} \input{structallg.tex} \end{frame} %------------------------------------------------ \begin{frame}[fragile, allowframebreaks]{C Syntax} Definition: \begin{lstlisting} struct Adresse { char name[50]; char strasse[100]; short hausnummer; long plz; char stadt[50]; }; \end{lstlisting} Anwendung: \begin{lstlisting} // Variable der Struktur erstellen struct Adresse adresseKurt; // Zugriff auf die Elemente strcpy(adresseKurt.name, "Kurt Kanns"); adresseKurt.hausnummer = 23; adresseKurt.plz = 45678; \end{lstlisting} \framebreak Typdefinition mit typedef: \begin{lstlisting} typedef struct Adresse { char name[50]; short hausnummer; } ADR; ADR a1,a2; \end{lstlisting} \end{frame} \begin{frame}{Sonstiges} \begin{itemize} \item Strukturtypdeklaration: struct Adresse {…}; \item Gesamtlänge der Struktur: sizeof(Struktur) \item Zugriff auf einzelne Komponenten durch\\ Punktnotation: Adresse1.Vorname = “Peter“; \item Weitere Strukturen hinzufügen: struct Adresse Adresse5; \item Weiteres hinzufügen von Komponenten während der Laufzeit nicht möglich. \end{itemize} \end{frame} %------------------------------------------------ \begin{frame}[fragile]{Strukturen als Funktionsargument} Ohne Typedef: \begin{lstlisting} void testfunc(struct Adresse a){ long plz = a.plz; } \end{lstlisting} Mit Typedef: \begin{lstlisting} void testfunc(ADR a){ long plz = a.plz; } \end{lstlisting} \end{frame} %------------------------------------------------ \begin{frame}{Strukturen in Java} \begin{itemize} \item existieren nicht \item stattdessen Objekte \end{itemize} \end{frame} %---------------------------------------------------------------------------------------- % SECTION 2 %---------------------------------------------------------------------------------------- \section{Pointer} % Section title slide, unnumbered %------------------------------------------------ \begin{frame}{Grundlagen} TODO \end{frame} %------------------------------------------------ \begin{frame}{Pointer in C} TODO \end{frame} %------------------------------------------------ \begin{frame}[focus] Danke fuerr eure Aufmerksamkeit! \end{frame} %---------------------------------------------------------------------------------------- % CLOSING/SUPPLEMENTARY SLIDES %---------------------------------------------------------------------------------------- \appendix \begin{frame}{References} \nocite{*} % Display all references regardless of if they were cited \bibliography{example} \bibliographystyle{plain} \end{frame} \end{document}