Download presentation
Presentation is loading. Please wait.
2
Welcome to CISC220 Data Structures in C++ sakai.udel.edu http://www.udel.edu/CIS/220/jatlas/10S/ Office Hours: Mon / Wed 2:30PM - 4PM TAs: Miao Tang, Zequn (Richard) Huang
3
Who am I?
4
Who are you?
5
What will we learn? Pointers Lists Analysis/ Big O notation Stacks Queues Recursion Trees Sorting Heaps Graphs NP-completeness Hashing
6
How will we learn? Class exercises + Lab participation (5%) Homework problems/programming (10*3- 5% = 35%) Two programming projects (20%) Three tests (two midterm * 10%, final 20%)
7
What is a Data Structure?
11
Objectives for Today Manipulate pointers –read/write –create –dereference –assign value Reading - K+W P.1-P.6
12
Review of pointers & memory cf. K&W, Chapter P A C++ Primer section P.5
13
Smith Hall Newark, DE 19716 USA
15
How could we move the Department of Computer and Information Sciences?
16
Memory Address vs. Value Stored Consider memory to be a single huge array: –Each cell of the array has an address associated with it. –Each cell also stores some value. Don’t confuse the address referring to a memory location with the value stored in that location. 2342... 101 102 103 104 105...
17
Pointers An address refers to a particular memory location. In other words, it points to a memory location. Pointer: A variable that contains the address of a variable. z 2342... 101 102 103 104 105... x y Location (address) name 104
18
Pointers How to initialize a pointer: – can initialize to NULL (i.e. not currently pointing to anything) – & operator: get address of a variable int *x; x?y? int y = 3; x?y3 x = &y; xy3
19
Pointers How to get the value that is pointed to? – * “ dereference operator”: get value pointed to * x returns 3 How to change the variable pointed to? – Use dereference * operator to left of = xy5 *x = 5 ; xy3
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.