Lecture Summaries - Week 11
Jump To:
[Lecture Index |
Previous Week's Lectures |
Next Week's Lectures]
Topics covered:
- Summary of different variables.
- Rules for initializing local and global variables.
- How to initialize local and global arrays.
- Why we need static local variables and how they work.
- An incorrect example of a function that counts how many times
it is called
(tstfnc1.c).
- A fixed version using global variables.
(tstfncg.c).
- An even better version using static variables
(tstfnc2.c).
- How to use extern to access globals defined in
another file.
- How to use static to limit access to globals to
the file in which they are defined.
Reading: Chapter 8.3
Topics covered:
- What is a pointer.
- How pointers are represented on the computer.
- How to declare pointers.
- How to initialize a pointer.
- How to follow a pointer.
- How pointers are used to return multiple values.
- Using pointers to write a function to return the quotient
and remainder of the division of two values.
(div.c).
- A cookbook for transforming functions to return values
through pointers.
Reading: Chapter 9.1, Chapter 14.1.
Topics covered:
- The idea of input and output parameters.
- A cookbook approach to returning more than one value using pointers.
- Using pointers to write a function to return the smallest
and largest values in an array.
(minmax1.c).
- Using pointers to write a function to return the smallest
and largest values in an array (trickier version).
(minmax2.c).
- How the name of an array is a pointer to its first element.
- How array subscripting really works.
- The basics of pointer arithmetic.
- Why changing an array parameter changes the array in the caller.
Reading: Chapter 9.2.
[EE150 Home Page |
Top Of Page]