code example u. allg. struct

This commit is contained in:
lukas-heiligenbrunner 2020-04-17 11:01:58 +02:00
parent 6ef9e1d575
commit cd931da5ad
2 changed files with 73 additions and 15 deletions

View File

@ -2,7 +2,7 @@
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS % PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
\documentclass{beamer} \documentclass[usenames,dvipsnames]{beamer}
\usetheme{focus} % Use the Focus theme supplied with the template \usetheme{focus} % Use the Focus theme supplied with the template
% Add option [numbering=none] to disable the footer progress bar % Add option [numbering=none] to disable the footer progress bar
@ -14,11 +14,48 @@
%------------------------------------------------ %------------------------------------------------
\usepackage[utf8]{inputenc}
\usepackage{booktabs} \usepackage{booktabs}
\usepackage{amsmath} \usepackage{amsmath}
\usepackage{hyperref} \usepackage{hyperref}
\usepackage{graphicx} \usepackage{graphicx}
\usepackage{listings} % Required for better table rules \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=\small\selectfont\ttfamily,
% keyword highlighting
classoffset=1, % starting new class
otherkeywords={>,<,.,;,-,+,!,=,~,:,[,],NULL,&},
morekeywords={>,<,.,;,-,+,!,=,~,:,[,],NULL,&},
keywordstyle=\color{codeorange},
classoffset=0
}
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------
% TITLE SLIDE % TITLE SLIDE
@ -53,15 +90,14 @@
%------------------------------------------------ %------------------------------------------------
\begin{frame}{Strukturen Allgemein} \begin{frame}{Strukturen Allgemein}
\begin{itemize} \input{structallg.tex}
\item kategorisieren von Variablen
\end{itemize}
\end{frame} \end{frame}
%------------------------------------------------ %------------------------------------------------
\begin{frame}{Strukturen in C} \begin{frame}[fragile]{Strukturen in C}
\begin{lstlisting}[language=c,label={lst:lstlisting}] Syntax:
\begin{lstlisting}
struct adresse { struct adresse {
char name[50]; char name[50];
char strasse[100]; char strasse[100];
@ -72,6 +108,16 @@
\end{lstlisting} \end{lstlisting}
\end{frame} \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}{Strukturen als Funktionsargument} \begin{frame}{Strukturen als Funktionsargument}
@ -211,7 +257,7 @@
%------------------------------------------------ %------------------------------------------------
\begin{frame}[focus] \begin{frame}[focus]
Danke für eure Aufmerksamkeit! Danke fuerr eure Aufmerksamkeit!
\end{frame} \end{frame}
%---------------------------------------------------------------------------------------- %----------------------------------------------------------------------------------------

12
src/structallg.tex Normal file
View File

@ -0,0 +1,12 @@
\begin{itemize}
\item kategorisieren von Variablen
\begin{itemize}
\item Variablen \textit{(int, char, double, float)}
\item Pointer
\item Arrays
\end{itemize}
\item Befehl \textit{struct}
\item verbessert übersicht
\item Schritt richtung Objektorientierung
\item ideal für Listen und Baumstruktur
\end{itemize}