\documentclass{beamer}
%
%
\makeatletter
\@ifundefined{lhs2tex.lhs2tex.sty.read}%
  {\@namedef{lhs2tex.lhs2tex.sty.read}{}%
   \newcommand\SkipToFmtEnd{}%
   \newcommand\EndFmtInput{}%
   \long\def\SkipToFmtEnd#1\EndFmtInput{}%
  }\SkipToFmtEnd

\newcommand\ReadOnlyOnce[1]{\@ifundefined{#1}{\@namedef{#1}{}}\SkipToFmtEnd}
\usepackage{amstext}
\usepackage{amssymb}
\usepackage{stmaryrd}
\DeclareFontFamily{OT1}{cmtex}{}
\DeclareFontShape{OT1}{cmtex}{m}{n}
  {<5><6><7><8>cmtex8
   <9>cmtex9
   <10><10.95><12><14.4><17.28><20.74><24.88>cmtex10}{}
\DeclareFontShape{OT1}{cmtex}{m}{it}
  {<-> ssub * cmtt/m/it}{}
\newcommand{\texfamily}{\fontfamily{cmtex}\selectfont}
\DeclareFontShape{OT1}{cmtt}{bx}{n}
  {<5><6><7><8>cmtt8
   <9>cmbtt9
   <10><10.95><12><14.4><17.28><20.74><24.88>cmbtt10}{}
\DeclareFontShape{OT1}{cmtex}{bx}{n}
  {<-> ssub * cmtt/bx/n}{}
\newcommand{\tex}[1]{\text{\texfamily#1}}	% NEU

\newcommand{\Sp}{\hskip.33334em\relax}
\newcommand{\NB}{\textbf{NB}}
\newcommand{\Todo}[1]{$\langle$\textbf{To do:}~#1$\rangle$}

\EndFmtInput
\makeatother
%
\author{Piyush P Kurur\\
  Office no: 224\\
  Dept. of Comp. Sci. and Engg.\\
  IIT Kanpur}


\newcommand{\Token}[2][]{\node(#2#1)[token]{#2};}
\newcommand{\Symbol}[2][]{\node(#2#1)[symbol]{#2};}
\newcommand{\Point}[1]{\node(#1)[point]{#1};}

\usepackage{tikz}
\usetikzlibrary{positioning,shapes,chains,fit}
\usetikzlibrary{shapes.symbols}
\usetikzlibrary{matrix}
\usetikzlibrary{backgrounds}
\usetikzlibrary{shapes.geometric}
\usepackage{multicol}

\usepackage{algorithm2e}
\usepackage{pgfkeys}
\usepackage{multicol}
\pgfkeys %
    {%
      /tikz/box/.style={ 
        shape=rectangle,%
        minimum size=2em,%
        top color=white,
        bottom color=red!50!black!50,
        inner sep=0pt},
      /tikz/garbage/.style={%
        starburst,%
        fill=yellow,%
        draw=red
      }
    }


\title{Fundamentals of Computing: Lecture 16}
\date{September 4, 2009}
\begin{document}
\begin{frame}
  \maketitle
\end{frame}

\begin{frame}
  \frametitle{Summary of the previous lecture}

  \begin{itemize}
  \item Integers can be added and subtracted to pointers.
  \item Difference of two pointers can be taken if they are of the
    same type.
  \item The operator \text{\tt ptr\char43{}\char43{}} etc also works.
    array.
  \end{itemize} 
    
\end{frame}

\begin{frame}
  \frametitle{Summary continued...}
  \begin{itemize}
  \item For arrays \text{\tt T~a\char91{}100\char93{}} the value \text{\tt a} is the
    address of the starting element.
  \item The expression \text{\tt \char38{}a\char91{}i\char93{}} is equivalent to \text{\tt a\char43{}i}
  \item The expression \text{\tt a\char91{}i\char93{}} is equivalent to \text{\tt \char42{}\char40{}a\char43{}i\char41{}}.
  \end{itemize}
\end{frame}
\begin{frame}

\frametitle{Passing arrays to functions}
  
\begin{itemize}
\item The value of an array variable is the starting address.
\item Functions are call by value.
\end{itemize}
\end{frame}
\begin{frame}
  \begin{tabbing}\tt
~~~~~\char35{}include~\char60{}stdio\char46{}h\char62{}\\
\tt ~~~~~\\
\tt ~~~~~int~strlen\char40{}char~\char42{}ptr\char41{}\\
\tt ~~~~~\char123{}\\
\tt ~~~~~~~char~\char42{}start~\char61{}~ptr\char59{}\\
\tt ~~~~~~~while\char40{}\char42{}ptr\char41{}~ptr\char43{}\char43{}\char59{}\\
\tt ~~~~~~~return~ptr~\char45{}~start\char59{}\\
\tt ~~~~~\char125{}\\
\tt ~~~~~\\
\tt ~~~~~int~strlen\char40{}char~\char42{}ptr\char41{}\char59{}\\
\tt ~\\
\tt ~~~~~int~main\char40{}\char41{}\char123{}\\
\tt ~~~~~~~char~a\char91{}\char93{}~\char61{}~\char34{}hello~world\char34{}\char59{}\\
\tt ~~~~~~~printf\char40{}\char34{}length~is~\char37{}d\char92{}n\char34{}\char44{}~strlen\char40{}a\char41{}\char41{}\char59{}\\
\tt ~~~~~\char125{}
\end{tabbing}
\end{frame}

\begin{frame}
  \frametitle{Copying string}
  \begin{tabbing}\tt
~~~~~void~strcpy\char40{}char~\char42{}src\char44{}~char~\char42{}dest\char41{}~\\
\tt ~~~~~\char123{}\\
\tt ~~~~~~~while\char40{}\char42{}src\char41{}\\
\tt ~~~~~~~\char123{}\\
\tt ~~~~~~~~~\char42{}dest~\char61{}~\char42{}src\char59{}\\
\tt ~~~~~~~~~dest\char43{}\char43{}\char59{}~src\char43{}\char43{}\char59{}\\
\tt ~~~~~~~\char125{}\\
\tt ~~~~~\char125{}
\end{tabbing}
\end{frame}
\end{document}
