8000 Minor changes to memory management slides · estimand/intro-to-cpp@be54c5f · GitHub
[go: up one dir, main page]

Skip to content

Commit be54c5f

Browse files
committed
Minor changes to memory management slides
1 parent 860e123 commit be54c5f

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed
93 Bytes
Binary file not shown.

03_memory_management/slides/memory_management.tex

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
\section{Arrays}
1010

11-
\begin{frame}[fragile]{Arrays}
11+
\begin{frame}[fragile,t]{Arrays}
1212
\begin{onlyenv}<1>
1313
\begin{block}{Arrays\ldots}
1414
\begin{itemize}
@@ -25,7 +25,8 @@ \section{Arrays}
2525
\begin{onlyenv}<2>
2626
\begin{itemize}
2727
\item The size of arrays must be known at compile time
28-
\item Arrays can also be \alert{allocated dynamically}
28+
\item Arrays (and other types) can also be
29+
\alert{allocated dynamically}
2930
\end{itemize}
3031
\begin{cpp}
3132
int n = 5;
@@ -56,9 +57,7 @@ \section{Arrays}
5657

5758
\section{Pointers}
5859

59-
% Example of pointers to stack that go out of scope in code!
60-
61-
\begin{frame}[fragile]{Pointers}
60+
\begin{frame}[fragile,t]{Pointers}
6261
\begin{onlyenv}<1>
6362
\begin{block}{Pointers\ldots}
6463
\begin{itemize}
@@ -94,8 +93,10 @@ \section{Pointers}
9493
\item Careful with static memory!
9594
\end{itemize}
9695
\begin{cpp}
97-
int x = 5;
96+
int x = 3;
9897
int x_ptr = &x;
98+
99+
*x_ptr = 5;
99100
\end{cpp}
100101
\end{block}
101102
\end{onlyenv}

0 commit comments

Comments
 (0)
0