Select Git revision
hp-uebung-20231116.tex
Forked from
Peter Gerwinski / hp
57 commits behind the upstream repository.
-
Peter Gerwinski authoredPeter Gerwinski authored
hp-uebung-20231116.tex 6.75 KiB
% hp-uebung-20231116.pdf - Exercises on Low-Level Programming / Applied Computer Sciences
% Copyright (C) 2013, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Peter Gerwinski
%
% This document is free software: you can redistribute it and/or
% modify it either under the terms of the Creative Commons
% Attribution-ShareAlike 3.0 License, or under the terms of the
% GNU General Public License as published by the Free Software
% Foundation, either version 3 of the License, or (at your option)
% any later version.
%
% This document is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this document. If not, see <http://www.gnu.org/licenses/>.
%
% You should have received a copy of the Creative Commons
% Attribution-ShareAlike 3.0 Unported License along with this
% document. If not, see <http://creativecommons.org/licenses/>.
% README: Trickprogrammierung, Thermometer-Baustein an I²C-Bus, Speicherformate von Zahlen
\documentclass[a4paper]{article}
\usepackage{pgscript}
\usepackage{gensymb}
\newcommand{\ItwoC}{I\raisebox{0.5ex}{\footnotesize 2}C}
\newcommand{\ITWOC}{I\raisebox{0.5ex}{\normalsize 2}C}
\begin{document}
\thispagestyle{empty}
\section*{Hardwarenahe Programmierung\\
Übungsaufgaben -- 16.\ November 2023}
Diese Übung enthält Punkteangaben wie in einer Klausur.
Um zu "`bestehen"', müssen Sie innerhalb von 90 Minuten
unter Verwendung ausschließlich zugelassener Hilfsmittel
15 Punkte (von insgesamt \totalpoints) erreichen.
\exercise{Trickprogrammierung}
Wir betrachten das folgende Programm (Datei: \gitfile{hp}{2023ws/20231116}{aufgabe-1.c}):
\begin{lstlisting}
#include <stdio.h>
#include <stdint.h>
int main (void)
{
uint64_t x = 4262939000843297096;
char *s = &x;
printf ("%s\n", s);
return 0;
}
\end{lstlisting}
Das Programm wird compiliert und auf einem 64-Bit-Little-Endian-Computer ausgeführt:
\begin{lstlisting}[style=terminal]
$ ¡gcc -Wall -O aufgabe-1.c -o aufgabe-1¿
aufgabe-1.c: In function `main':
aufgabe-1.c:7:13: warning: initialization from incompatible pointer type [...]
$ ¡./aufgabe-1¿
Hallo
\end{lstlisting}
\begin{itemize}
\item[(a)]